2
# Copyright (C) 2000-2001, 2003 MySQL AB
4
# This library is free software; you can redistribute it and/or
5
# modify it under the terms of the GNU Library General Public
6
# License as published by the Free Software Foundation; version 2
9
# This library is distributed in the hope that it will be useful,
10
# but WITHOUT ANY WARRANTY; without even the implied warranty of
11
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12
# Library General Public License for more details.
14
# You should have received a copy of the GNU Library General Public
15
# License along with this library; if not, write to the Free
16
# Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
19
# a little program to generate a table of results
20
# just read all the RUN-*.log files and format them nicely
21
# Made by Luuk de Boer
28
$opt_machine=$opt_cmp="";
29
$opt_relative=$opt_same_server=$opt_help=$opt_Information=$opt_skip_count=$opt_no_bars=$opt_verbose=0;
31
GetOptions("Information","help","server=s","cmp=s","machine=s","relative","same-server","dir=s","skip-count","no-bars","html","verbose") || usage();
33
usage() if ($opt_help || $opt_Information);
35
$opt_cmp=lc(join(",",sort(split(',',$opt_cmp))));
39
$files="$opt_dir/RUN-$opt_server*$opt_machine";
43
$files="$opt_dir/RUN-*$opt_machine";
45
$files.= "-cmp-$opt_cmp" if (length($opt_cmp));
48
# Go trough all RUN files and gather statistics.
59
next if (!$opt_cmp && /-cmp-/ && $automatic_files || defined($found{$_}));
61
$found{$_}=1; # Remove dupplicates
63
$tot{$prog}{'version'}=$1;
64
push(@key_order,$prog);
66
open(TMP, "<$filename") || die "Can't open $filename: $!\n";
71
if (/Server version:\s+(\S+.*)/i)
73
$tot{$prog}{'server'} = $1;
75
elsif (/Arguments:\s+(.+)/i)
78
# Remove some standard, not informative arguments
79
$arguments =~ s/--force|--log|--use-old\S*|--server=\S+|--cmp=\S+|--user=\S+|--pass=\S+|--machine=\S+|--dir=\S+//g;
80
if (($tmp=index($arguments,"--comment")) >= 0)
82
if (($end=index($arguments,$tmp+2,"--")) >= 0)
84
substr($arguments,$tmp,($end-$tmp))="";
88
$arguments=substr($arguments,0,$tmp);
91
$arguments =~ s/\s+/ /g;
92
$tot{$prog}{'arguments'}=$arguments;
94
elsif (/Comments:\s+(.+)/i) {
95
$tot{$prog}{'comments'} = $1;
96
} elsif (/^(\S+):.*(estimated\s|)total\stime:\s+([\d.]+)\s+(wallclock\s|)secs/i)
98
$tmp = $1; $tmp =~ s/://;
99
$tot{$prog}{$tmp} = [ $3, (length($2) ? "+" : "")];
101
} elsif (/Totals per operation:/i) {
108
if (/^(\S+)\s+([\d.]+)\s+([\d.]+)\s+([\d.]+)\s+([\d.]+)\s+([\d.]+)\s*([+|?])*/)
110
$tot1{$prog}{$1} = [$2,$6,$7];
119
print "Didn't find any files matching: '$files'\n";
120
print "Use the --cmp=server,server option to compare benchmarks\n";
125
# everything is loaded ...
126
# now we have to create a fancy output :-)
128
# I prefer to redirect scripts instead to force it to file ; Monty
130
# open(RES, ">$resultfile") || die "Can't write to $resultfile: $!\n";
142
# some output + format functions;
147
This is the result file of the different benchmark tests.
149
The number in () after each tests shows how many SQL commands the particular
150
test did. As one test may have many different parameters this gives only
151
a rough picture of what was done. Check the source for more information :)
153
Keep in mind that one can\'t compare benchmarks run with different --cmp
154
options. The --cmp options sets the all limits according to the worst
155
limit for all server in the benchmark.
157
Numbers marked with '+' are estimated according to previous runs because
158
the query took longer than a given time-limit to finish. The estimation
159
shouldn\'t be far from the real result thought.
161
Numbers marked with '?' contains results that gave wrong result. This can only
162
be used as an indication of how long it took for the server to produce a wrong
165
Numbers marked with '*' are tests that was run a different number times
166
than the test in the first column. The reason for this is normally that the
167
marked test was run with different options that affects the number of tests
168
or that the test was from another version of the MySQL benchmarks.
170
Hope this will give you some idea how each db is performing at what thing ....
171
Hope you like it .... Luuk & Monty (1997)
177
print "Column 1 is in seconds. All other columns are presented relative\n";
178
print "to this. 1.00 is the same, bigger numbers indicates slower\n\n";
183
print "The test values is printed in the format 'time:number of tests'\n";
186
if (length($opt_cmp))
188
print "The test was run with limits from: $opt_cmp\n\n";
190
print "The result logs which where found and the options:\n";
191
$bar= $opt_no_bars ? " " : "|";
193
# Move $opt_server first in array if not filename on command line
194
if ($automatic_files)
196
@key_order=sort {$a cmp $b} keys %tot;
197
for ($i=0; $i <= $#key_order; $i++)
199
if ($tot{$key_order[$i]}{'version'} =~ /^$opt_server-/)
201
unshift(@key_order,$key_order[$i]);
202
splice(@key_order,$i+1,1);
210
foreach $key (@key_order)
212
$tmp=$tmp=$tot{$key}{'version'};
213
$tmp =~ s/-cmp-$opt_cmp// if (length($opt_cmp));
215
printf "%2d %-40.40s: %s %s\n", $column_count, $tmp,
216
$tot{$key}{'server'}, $tot{$key}{'arguments'};
217
print " $tot{$key}{'comments'}\n"
218
if ($tot{$key}{'comments'} =~ /\w+/);
223
$namewidth=($opt_skip_count && !$opt_verbose) ? 29 : 36;
224
$colwidth= $opt_relative ? 10 : 7;
226
$colwidth+=$count_width if ($opt_verbose);
229
printf "%-$namewidth.${namewidth}s${bar}", "Operation";
231
foreach $key (@key_order)
233
printf "%${colwidth}d${bar}", $count;
236
printf "\n%-$namewidth.${namewidth}s${bar}", "";
237
foreach $key (@key_order)
239
$ver=$tot{$key}{'version'};
240
$ver =~ s/-[a-zA-Z0-9_\.]+-cmp-$opt-cmp$//;
241
printf "%${colwidth}.${colwidth}s${bar}", $ver;
245
print_string($opt_relative ? "Relative results per test (First column is in seconds):" : "Results per test in seconds:");
248
foreach $key (sort {$a cmp $b} keys %op1)
250
printf "%-$namewidth.${namewidth}s${bar}", $key;
252
foreach $server (@key_order)
254
print_value($first,$tot{$server}{$key}->[0],undef(),$tot{$server}{$key}->[1]);
255
$first=$tot{$server}{$key}->[0] if (!defined($first));
261
print_string("The results per operation:");
264
foreach $key (sort {$a cmp $b} keys %op)
266
next if ($key =~ /TOTALS/i);
268
$count=$tot1{$key_order[0]}{$key}->[1];
269
$tmp.= " (" . $count . ")" if (!$skip_count);
270
printf "%-$namewidth.${namewidth}s${bar}", $tmp;
272
foreach $server (@key_order)
274
$tmp= $count != $tot1{$server}{$key}->[1] ? "*" : "";
275
print_value($first,$tot1{$server}{$key}->[0],$tot1{$server}{$key}->[1],
276
$tot1{$server}{$key}->[2] . $tmp);
277
$first=$tot1{$server}{$key}->[0] if (!defined($first));
284
printf "%-$namewidth.${namewidth}s${bar}", $key;
286
foreach $server (@key_order)
288
print_value($first,$tot1{$server}{$key}->[0],undef(),
289
$tot1{$server}{$key}->[2]);
290
$first=$tot1{$server}{$key}->[0] if (!defined($first));
299
my $template="template.html";
300
my $title="MySQL | | Information | Benchmarks | Compare with $opt_cmp";
301
my $image="info.gif";
304
open(TEMPLATE, $template) || die;
310
print "<!---- This is AUTOMATICALLY Generated. Do not edit here! ---->\n";
312
elsif (/TITLE:SUBTITLE/)
314
s|TITLE:SUBTITLE|$title|;
317
elsif (/TITLE:COMPARE/)
319
s|TITLE:COMPARE|$opt_cmp|;
322
elsif (/ subchapter name /)
324
# Nothing here for now
327
elsif (/ text of chapter /)
343
my ($title,$count,$key);
346
<font size=+4><b>MySQL Benchmark Results</b></font><br>
347
<font size=+1><b>Compare with $opt_cmp</b></font><p><p>
349
This is the result file of the different benchmark tests.
352
The number in () after each tests shows how many SQL commands the particular
353
test did. As one test may have many different parameters this gives only
354
a rough picture of what was done. Check the source for more information.
356
Keep in mind that one can\'t compare benchmarks run with different --cmp
357
options. The --cmp options sets the all limits according to the worst
358
limit for all server in the benchmark.
360
Numbers marked with '+' are estimated according to previous runs because
361
the query took longer than a given time-limit to finish. The estimation
362
shouldn\'t be far from the real result thought.
364
Numbers marked with '?' contains results that gave wrong result. This can only
365
be used as an indication of how long it took for the server to produce a wrong
368
Hope this will give you some idea how each db is performing at what thing ....
370
Hope you like it .... Luuk & Monty (1997)
376
print "Column 1 is in seconds. All other columns are presented relative<br>\n";
377
print "to this. 1.00 is the same, bigger numbers indicates slower<p>\n\n";
380
if (length($opt_cmp))
382
print "The test was run with limits from: $opt_cmp\n\n";
384
print "The result logs which where found and the options:<br>\n";
386
# Move $opt_server first in array
387
if ($automatic_files)
389
@key_order=sort {$a cmp $b} keys %tot;
390
for ($i=0; $i <= $#key_order; $i++)
392
if ($tot{$key_order[$i]}{'version'} =~ /^$opt_server-/)
394
unshift(@key_order,$key_order[$i]);
395
splice(@key_order,$i+1,1);
401
print "<p><center><table border=1 width=100%>\n";
403
foreach $key (@key_order)
405
$tmp=$tot{$key}{'version'};
406
$tmp =~ s/-cmp-$opt_cmp// if (length($opt_cmp));
408
# printf "<tr><td>%2d<td>%-36.36s<td>%s %s</tr>\n", $column_count, $tmp,
409
printf "<tr><td>%2d</td><td>%s</td><td>%s %s</td></tr>\n",
410
$column_count, $tmp, $tot{$key}{'server'}, $tot{$key}{'arguments'};
411
print "<tr><td colspan=3>$tot{$key}{'comments'}</td></tr>\n"
412
if ($tot{$key}{'comments'} =~ /\w+/);
415
print "</table></center><p><center><table border=1 width=100%>\n";
417
$namewidth=$opt_skip_count ? 22 :29;
418
$colwidth= $opt_relative ? 10 : 7;
421
printf "<tr><td><b>%s</b></td>\n", "Operation";
423
foreach $key (@key_order)
425
$ver=$tot{$key}{'version'};
426
printf "<td align=center><b>%d", $count;
427
printf "<br>%${colwidth}.${colwidth}s</b></td>\n", substr($ver,0,index($ver,"-"));
431
$title = $opt_relative ? "Relative results per test (First column is in seconds):" : "Results per test in seconds:";
432
printf "<tr><td colspan=%d><b>%s</b></td></tr>\n", $count, $title;
434
foreach $key (sort {$a cmp $b} keys %op1)
438
printf "<tr><td>%-$namewidth.${namewidth}s</td>", $key;
442
print "<tr><td>$key</td>";
445
foreach $server (@key_order)
447
print_value($first,$tot{$server}{$key}->[0],undef(),
448
$tot{$server}{$key}->[1]);
449
$first=$tot{$server}{$key}->[0] if (!defined($first));
454
$title = "The results per operation:";
455
printf "<tr><td colspan=%d><b>%s</b></td></tr>\n", $count, $title;
457
foreach $key (sort {$a cmp $b} keys %op)
459
next if ($key =~ /TOTALS/i);
461
$tmp.= " (" . $tot1{$key_order[0]}{$key}->[1] . ")" if (!$skip_count);
464
printf "<tr><td>%-$namewidth.${namewidth}s</td>", $tmp;
468
print "<tr><td>$tmp</td>";
471
foreach $server (@key_order)
473
print_value($first,$tot1{$server}{$key}->[0],
474
$tot1{$server}{$key}->[1],
475
$tot1{$server}{$key}->[2]);
476
$first=$tot1{$server}{$key}->[0] if (!defined($first));
482
printf "<tr><td><b>%-$namewidth.${namewidth}s</b></td>", $key;
484
foreach $server (@key_order)
486
print_value($first,$tot1{$server}{$key}->[0],undef(),
487
$tot1{$server}{$key}->[2]);
488
$first=$tot1{$server}{$key}->[0] if (!defined($first));
490
print "</tr>\n</table>\n";
497
print $sep x ($namewidth + (($colwidth+1) * $column_count)+1),"\n";
503
my ($first,$value,$count,$flags)=@_;
508
if (!defined($first) || !$opt_relative)
510
$tmp=sprintf("%.2f",$value);
514
$first=1 if ($first == 0); # Assume that it took one second instead of 0
515
$tmp= sprintf("%.2f",$value/$first);
519
$tmp="+".$tmp if ($flags =~ /\+/);
520
$tmp="?".$tmp if ($flags =~ /\?/);
521
$tmp="*".$tmp if ($flags =~ /\*/);
528
$width= ($opt_verbose ? $colwidth - $count_width : $colwidth);
531
$tmp= " " x ($width-length($tmp)) . $tmp if (length($tmp) < $width);
537
$tmp.= ":" . " " x ($count_width-1-length($count)) . $count;
541
$tmp.= " " x ($count_width);
546
print $tmp . "${bar}";
548
print "<td align=right>$tmp</td>";
559
$width=$namewidth + ($colwidth+1)*$column_count;
560
$str=substr($str,1,$width) if (length($str) > $width);
561
print($str," " x ($width - length($str)),"${bar}\n");
575
This program parses all RUN files from old 'run-all-tests --log' scripts
576
and makes a nice comparable table.
578
$0 takes currently the following options:
580
--help or --Information
583
--cmp=server,server,server (Default $opt_cmp)
584
Compares all runs that are done with the same --cmp options to run-all-tests.
585
The most normal options are '--cmp=mysql,pg,solid' and '--cmp ""'
587
--dir=... (Default $opt_dir)
588
From which directory one should get the runs. All runs made by
589
run-all-tests --log is saved in the 'output' directory.
590
In the 'results' directory you may have some example runs from different
594
Print the table in html format.
596
--machine='full-machine-name' (Default $opt_machine)
597
Use only runs that match this machine.
600
Show all numbers in times of the first server where the time for the
604
Compare all runs for --server=.... The --machine is not used in this case
605
This is nice to compare how the same server runs on different machines.
607
--server='server name' (Default $opt_server)
608
Put this server in the first result column.
611
Do not write the number of tests after the test-name.
614
Write the number of tests in each column. This is useful when some column