2
# Copyright (c) 2000, 2001, 2006 MySQL AB, 2009 Sun Microsystems, Inc.
3
# Use is subject to license terms.
5
# This library is free software; you can redistribute it and/or
6
# modify it under the terms of the GNU Library General Public
7
# License as published by the Free Software Foundation; version 2
10
# This library is distributed in the hope that it will be useful,
11
# but WITHOUT ANY WARRANTY; without even the implied warranty of
12
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13
# Library General Public License for more details.
15
# You should have received a copy of the GNU Library General Public
16
# License along with this library; if not, write to the Free
17
# Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,
20
# a little program to generate a table of results
21
# just read all the RUN-*.log files and format them nicely
22
# Made by Luuk de Boer
29
$opt_machine=$opt_cmp="";
30
$opt_relative=$opt_same_server=$opt_help=$opt_Information=$opt_skip_count=$opt_no_bars=$opt_verbose=0;
32
GetOptions("Information","help","server=s","cmp=s","machine=s","relative","same-server","dir=s","skip-count","no-bars","html","verbose") || usage();
34
usage() if ($opt_help || $opt_Information);
36
$opt_cmp=lc(join(",",sort(split(',',$opt_cmp))));
40
$files="$opt_dir/RUN-$opt_server*$opt_machine";
44
$files="$opt_dir/RUN-*$opt_machine";
46
$files.= "-cmp-$opt_cmp" if (length($opt_cmp));
49
# Go trough all RUN files and gather statistics.
60
next if (!$opt_cmp && /-cmp-/ && $automatic_files || defined($found{$_}));
62
$found{$_}=1; # Remove dupplicates
64
$tot{$prog}{'version'}=$1;
65
push(@key_order,$prog);
67
open(TMP, "<$filename") || die "Can't open $filename: $!\n";
72
if (/Server version:\s+(\S+.*)/i)
74
$tot{$prog}{'server'} = $1;
76
elsif (/Arguments:\s+(.+)/i)
79
# Remove some standard, not informative arguments
80
$arguments =~ s/--force|--log|--use-old\S*|--server=\S+|--cmp=\S+|--user=\S+|--pass=\S+|--machine=\S+|--dir=\S+//g;
81
if (($tmp=index($arguments,"--comment")) >= 0)
83
if (($end=index($arguments,$tmp+2,"--")) >= 0)
85
substr($arguments,$tmp,($end-$tmp))="";
89
$arguments=substr($arguments,0,$tmp);
92
$arguments =~ s/\s+/ /g;
93
$tot{$prog}{'arguments'}=$arguments;
95
elsif (/Comments:\s+(.+)/i) {
96
$tot{$prog}{'comments'} = $1;
97
} elsif (/^(\S+):.*(estimated\s|)total\stime:\s+([\d.]+)\s+(wallclock\s|)secs/i)
99
$tmp = $1; $tmp =~ s/://;
100
$tot{$prog}{$tmp} = [ $3, (length($2) ? "+" : "")];
102
} elsif (/Totals per operation:/i) {
109
if (/^(\S+)\s+([\d.]+)\s+([\d.]+)\s+([\d.]+)\s+([\d.]+)\s+([\d.]+)\s*([+|?])*/)
111
$tot1{$prog}{$1} = [$2,$6,$7];
120
print "Didn't find any files matching: '$files'\n";
121
print "Use the --cmp=server,server option to compare benchmarks\n";
126
# everything is loaded ...
127
# now we have to create a fancy output :-)
129
# I prefer to redirect scripts instead to force it to file ; Monty
131
# open(RES, ">$resultfile") || die "Can't write to $resultfile: $!\n";
143
# some output + format functions;
148
This is the result file of the different benchmark tests.
150
The number in () after each tests shows how many SQL commands the particular
151
test did. As one test may have many different parameters this gives only
152
a rough picture of what was done. Check the source for more information :)
154
Keep in mind that one can\'t compare benchmarks run with different --cmp
155
options. The --cmp options sets the all limits according to the worst
156
limit for all server in the benchmark.
158
Numbers marked with '+' are estimated according to previous runs because
159
the query took longer than a given time-limit to finish. The estimation
160
shouldn\'t be far from the real result thought.
162
Numbers marked with '?' contains results that gave wrong result. This can only
163
be used as an indication of how long it took for the server to produce a wrong
166
Numbers marked with '*' are tests that was run a different number times
167
than the test in the first column. The reason for this is normally that the
168
marked test was run with different options that affects the number of tests
169
or that the test was from another version of the MySQL benchmarks.
171
Hope this will give you some idea how each db is performing at what thing ....
172
Hope you like it .... Luuk & Monty (1997)
178
print "Column 1 is in seconds. All other columns are presented relative\n";
179
print "to this. 1.00 is the same, bigger numbers indicates slower\n\n";
184
print "The test values is printed in the format 'time:number of tests'\n";
187
if (length($opt_cmp))
189
print "The test was run with limits from: $opt_cmp\n\n";
191
print "The result logs which where found and the options:\n";
192
$bar= $opt_no_bars ? " " : "|";
194
# Move $opt_server first in array if not filename on command line
195
if ($automatic_files)
197
@key_order=sort {$a cmp $b} keys %tot;
198
for ($i=0; $i <= $#key_order; $i++)
200
if ($tot{$key_order[$i]}{'version'} =~ /^$opt_server-/)
202
unshift(@key_order,$key_order[$i]);
203
splice(@key_order,$i+1,1);
211
foreach $key (@key_order)
213
$tmp=$tmp=$tot{$key}{'version'};
214
$tmp =~ s/-cmp-$opt_cmp// if (length($opt_cmp));
216
printf "%2d %-40.40s: %s %s\n", $column_count, $tmp,
217
$tot{$key}{'server'}, $tot{$key}{'arguments'};
218
print " $tot{$key}{'comments'}\n"
219
if ($tot{$key}{'comments'} =~ /\w+/);
224
$namewidth=($opt_skip_count && !$opt_verbose) ? 29 : 36;
225
$colwidth= $opt_relative ? 10 : 7;
227
$colwidth+=$count_width if ($opt_verbose);
230
printf "%-$namewidth.${namewidth}s${bar}", "Operation";
232
foreach $key (@key_order)
234
printf "%${colwidth}d${bar}", $count;
237
printf "\n%-$namewidth.${namewidth}s${bar}", "";
238
foreach $key (@key_order)
240
$ver=$tot{$key}{'version'};
241
$ver =~ s/-[a-zA-Z0-9_\.]+-cmp-$opt-cmp$//;
242
printf "%${colwidth}.${colwidth}s${bar}", $ver;
246
print_string($opt_relative ? "Relative results per test (First column is in seconds):" : "Results per test in seconds:");
249
foreach $key (sort {$a cmp $b} keys %op1)
251
printf "%-$namewidth.${namewidth}s${bar}", $key;
253
foreach $server (@key_order)
255
print_value($first,$tot{$server}{$key}->[0],undef(),$tot{$server}{$key}->[1]);
256
$first=$tot{$server}{$key}->[0] if (!defined($first));
262
print_string("The results per operation:");
265
foreach $key (sort {$a cmp $b} keys %op)
267
next if ($key =~ /TOTALS/i);
269
$count=$tot1{$key_order[0]}{$key}->[1];
270
$tmp.= " (" . $count . ")" if (!$skip_count);
271
printf "%-$namewidth.${namewidth}s${bar}", $tmp;
273
foreach $server (@key_order)
275
$tmp= $count != $tot1{$server}{$key}->[1] ? "*" : "";
276
print_value($first,$tot1{$server}{$key}->[0],$tot1{$server}{$key}->[1],
277
$tot1{$server}{$key}->[2] . $tmp);
278
$first=$tot1{$server}{$key}->[0] if (!defined($first));
285
printf "%-$namewidth.${namewidth}s${bar}", $key;
287
foreach $server (@key_order)
289
print_value($first,$tot1{$server}{$key}->[0],undef(),
290
$tot1{$server}{$key}->[2]);
291
$first=$tot1{$server}{$key}->[0] if (!defined($first));
300
my $template="template.html";
301
my $title="MySQL | | Information | Benchmarks | Compare with $opt_cmp";
302
my $image="info.gif";
305
open(TEMPLATE, $template) || die;
311
print "<!---- This is AUTOMATICALLY Generated. Do not edit here! ---->\n";
313
elsif (/TITLE:SUBTITLE/)
315
s|TITLE:SUBTITLE|$title|;
318
elsif (/TITLE:COMPARE/)
320
s|TITLE:COMPARE|$opt_cmp|;
323
elsif (/ subchapter name /)
325
# Nothing here for now
328
elsif (/ text of chapter /)
344
my ($title,$count,$key);
347
<font size=+4><b>MySQL Benchmark Results</b></font><br>
348
<font size=+1><b>Compare with $opt_cmp</b></font><p><p>
350
This is the result file of the different benchmark tests.
353
The number in () after each tests shows how many SQL commands the particular
354
test did. As one test may have many different parameters this gives only
355
a rough picture of what was done. Check the source for more information.
357
Keep in mind that one can\'t compare benchmarks run with different --cmp
358
options. The --cmp options sets the all limits according to the worst
359
limit for all server in the benchmark.
361
Numbers marked with '+' are estimated according to previous runs because
362
the query took longer than a given time-limit to finish. The estimation
363
shouldn\'t be far from the real result thought.
365
Numbers marked with '?' contains results that gave wrong result. This can only
366
be used as an indication of how long it took for the server to produce a wrong
369
Hope this will give you some idea how each db is performing at what thing ....
371
Hope you like it .... Luuk & Monty (1997)
377
print "Column 1 is in seconds. All other columns are presented relative<br>\n";
378
print "to this. 1.00 is the same, bigger numbers indicates slower<p>\n\n";
381
if (length($opt_cmp))
383
print "The test was run with limits from: $opt_cmp\n\n";
385
print "The result logs which where found and the options:<br>\n";
387
# Move $opt_server first in array
388
if ($automatic_files)
390
@key_order=sort {$a cmp $b} keys %tot;
391
for ($i=0; $i <= $#key_order; $i++)
393
if ($tot{$key_order[$i]}{'version'} =~ /^$opt_server-/)
395
unshift(@key_order,$key_order[$i]);
396
splice(@key_order,$i+1,1);
402
print "<p><center><table border=1 width=100%>\n";
404
foreach $key (@key_order)
406
$tmp=$tot{$key}{'version'};
407
$tmp =~ s/-cmp-$opt_cmp// if (length($opt_cmp));
409
# printf "<tr><td>%2d<td>%-36.36s<td>%s %s</tr>\n", $column_count, $tmp,
410
printf "<tr><td>%2d</td><td>%s</td><td>%s %s</td></tr>\n",
411
$column_count, $tmp, $tot{$key}{'server'}, $tot{$key}{'arguments'};
412
print "<tr><td colspan=3>$tot{$key}{'comments'}</td></tr>\n"
413
if ($tot{$key}{'comments'} =~ /\w+/);
416
print "</table></center><p><center><table border=1 width=100%>\n";
418
$namewidth=$opt_skip_count ? 22 :29;
419
$colwidth= $opt_relative ? 10 : 7;
422
printf "<tr><td><b>%s</b></td>\n", "Operation";
424
foreach $key (@key_order)
426
$ver=$tot{$key}{'version'};
427
printf "<td align=center><b>%d", $count;
428
printf "<br>%${colwidth}.${colwidth}s</b></td>\n", substr($ver,0,index($ver,"-"));
432
$title = $opt_relative ? "Relative results per test (First column is in seconds):" : "Results per test in seconds:";
433
printf "<tr><td colspan=%d><b>%s</b></td></tr>\n", $count, $title;
435
foreach $key (sort {$a cmp $b} keys %op1)
439
printf "<tr><td>%-$namewidth.${namewidth}s</td>", $key;
443
print "<tr><td>$key</td>";
446
foreach $server (@key_order)
448
print_value($first,$tot{$server}{$key}->[0],undef(),
449
$tot{$server}{$key}->[1]);
450
$first=$tot{$server}{$key}->[0] if (!defined($first));
455
$title = "The results per operation:";
456
printf "<tr><td colspan=%d><b>%s</b></td></tr>\n", $count, $title;
458
foreach $key (sort {$a cmp $b} keys %op)
460
next if ($key =~ /TOTALS/i);
462
$tmp.= " (" . $tot1{$key_order[0]}{$key}->[1] . ")" if (!$skip_count);
465
printf "<tr><td>%-$namewidth.${namewidth}s</td>", $tmp;
469
print "<tr><td>$tmp</td>";
472
foreach $server (@key_order)
474
print_value($first,$tot1{$server}{$key}->[0],
475
$tot1{$server}{$key}->[1],
476
$tot1{$server}{$key}->[2]);
477
$first=$tot1{$server}{$key}->[0] if (!defined($first));
483
printf "<tr><td><b>%-$namewidth.${namewidth}s</b></td>", $key;
485
foreach $server (@key_order)
487
print_value($first,$tot1{$server}{$key}->[0],undef(),
488
$tot1{$server}{$key}->[2]);
489
$first=$tot1{$server}{$key}->[0] if (!defined($first));
491
print "</tr>\n</table>\n";
498
print $sep x ($namewidth + (($colwidth+1) * $column_count)+1),"\n";
504
my ($first,$value,$count,$flags)=@_;
509
if (!defined($first) || !$opt_relative)
511
$tmp=sprintf("%.2f",$value);
515
$first=1 if ($first == 0); # Assume that it took one second instead of 0
516
$tmp= sprintf("%.2f",$value/$first);
520
$tmp="+".$tmp if ($flags =~ /\+/);
521
$tmp="?".$tmp if ($flags =~ /\?/);
522
$tmp="*".$tmp if ($flags =~ /\*/);
529
$width= ($opt_verbose ? $colwidth - $count_width : $colwidth);
532
$tmp= " " x ($width-length($tmp)) . $tmp if (length($tmp) < $width);
538
$tmp.= ":" . " " x ($count_width-1-length($count)) . $count;
542
$tmp.= " " x ($count_width);
547
print $tmp . "${bar}";
549
print "<td align=right>$tmp</td>";
560
$width=$namewidth + ($colwidth+1)*$column_count;
561
$str=substr($str,1,$width) if (length($str) > $width);
562
print($str," " x ($width - length($str)),"${bar}\n");
576
This program parses all RUN files from old 'run-all-tests --log' scripts
577
and makes a nice comparable table.
579
$0 takes currently the following options:
581
--help or --Information
584
--cmp=server,server,server (Default $opt_cmp)
585
Compares all runs that are done with the same --cmp options to run-all-tests.
586
The most normal options are '--cmp=mysql,pg,solid' and '--cmp ""'
588
--dir=... (Default $opt_dir)
589
From which directory one should get the runs. All runs made by
590
run-all-tests --log is saved in the 'output' directory.
591
In the 'results' directory you may have some example runs from different
595
Print the table in html format.
597
--machine='full-machine-name' (Default $opt_machine)
598
Use only runs that match this machine.
601
Show all numbers in times of the first server where the time for the
605
Compare all runs for --server=.... The --machine is not used in this case
606
This is nice to compare how the same server runs on different machines.
608
--server='server name' (Default $opt_server)
609
Put this server in the first result column.
612
Do not write the number of tests after the test-name.
615
Write the number of tests in each column. This is useful when some column