📄 compare-results
字号:
} elsif (/TITLE:SUBTITLE/) { s|TITLE:SUBTITLE|$title|; print $_; } elsif (/TITLE:COMPARE/) { s|TITLE:COMPARE|$opt_cmp|; print $_; } elsif (/ subchapter name /) { # Nothing here for now print $_; } elsif (/ text of chapter /) { print $_; print_html_body(); } else { print $_; } } close(TEMPLATE);}sub print_html_body{ my ($title,$count,$key); print <<EOF;<center><font size=+4><b>MySQL Benchmark Results</b></font><br><font size=+1><b>Compare with $opt_cmp</b></font><p><p></center>This is the result file of the different benchmark tests.<p>The number in () after each tests shows how many SQL commands the particulartest did. As one test may have many different parameters this gives onlya rough picture of what was done. Check the source for more information.<p>Keep in mind that one can\'t compare benchmarks run with different --cmpoptions. The --cmp options sets the all limits according to the worstlimit for all server in the benchmark.<p>Numbers marked with '+' are estimated according to previous runs becausethe query took longer than a given time-limit to finish. The estimationshouldn\'t be far from the real result thought.<p>Numbers marked with '?' contains results that gave wrong result. This can onlybe used as an indication of how long it took for the server to produce a wrongresult :)<p>Hope this will give you some idea how each db is performing at what thing ....<br>Hope you like it .... Luuk & Monty (1997)<p><p>EOF if ($opt_relative) { print "Column 1 is in seconds. All other columns are presented relative<br>\n"; print "to this. 1.00 is the same, bigger numbers indicates slower<p>\n\n"; } if (length($opt_cmp)) { print "The test was run with limits from: $opt_cmp\n\n"; } print "The result logs which where found and the options:<br>\n"; # Move $opt_server first in array if ($automatic_files) { @key_order=sort {$a cmp $b} keys %tot; for ($i=0; $i <= $#key_order; $i++) { if ($tot{$key_order[$i]}{'version'} =~ /^$opt_server-/) { unshift(@key_order,$key_order[$i]); splice(@key_order,$i+1,1); last; } } } # Print header print "<p><center><table border=1 width=100%>\n"; $column_count=0; foreach $key (@key_order) { $tmp=$tot{$key}{'version'}; $tmp =~ s/-cmp-$opt_cmp// if (length($opt_cmp)); $column_count++;# printf "<tr><td>%2d<td>%-36.36s<td>%s %s</tr>\n", $column_count, $tmp, printf "<tr><td>%2d</td><td>%s</td><td>%s %s</td></tr>\n", $column_count, $tmp, $tot{$key}{'server'}, $tot{$key}{'arguments'}; print "<tr><td colspan=3>$tot{$key}{'comments'}</td></tr>\n" if ($tot{$key}{'comments'} =~ /\w+/); } print "</table></center><p><center><table border=1 width=100%>\n"; $namewidth=$opt_skip_count ? 22 :29; $colwidth= $opt_relative ? 10 : 7; $count_width=7; printf "<tr><td><b>%s</b></td>\n", "Operation"; $count = 1; foreach $key (@key_order) { $ver=$tot{$key}{'version'}; printf "<td align=center><b>%d", $count; printf "<br>%${colwidth}.${colwidth}s</b></td>\n", substr($ver,0,index($ver,"-")); $count++; } print "</tr>\n"; $title = $opt_relative ? "Relative results per test (First column is in seconds):" : "Results per test in seconds:"; printf "<tr><td colspan=%d><b>%s</b></td></tr>\n", $count, $title; foreach $key (sort {$a cmp $b} keys %op1) { if (!$opt_html) { printf "<tr><td>%-$namewidth.${namewidth}s</td>", $key; } else { print "<tr><td>$key</td>"; } $first=undef(); foreach $server (@key_order) { print_value($first,$tot{$server}{$key}->[0],undef(), $tot{$server}{$key}->[1]); $first=$tot{$server}{$key}->[0] if (!defined($first)); } print "</tr>\n"; } $title = "The results per operation:"; printf "<tr><td colspan=%d><b>%s</b></td></tr>\n", $count, $title; foreach $key (sort {$a cmp $b} keys %op) { next if ($key =~ /TOTALS/i); $tmp=$key; $tmp.= " (" . $tot1{$key_order[0]}{$key}->[1] . ")" if (!$skip_count); if (!$opt_html) { printf "<tr><td>%-$namewidth.${namewidth}s</td>", $tmp; } else { print "<tr><td>$tmp</td>"; } $first=undef(); foreach $server (@key_order) { print_value($first,$tot1{$server}{$key}->[0], $tot1{$server}{$key}->[1], $tot1{$server}{$key}->[2]); $first=$tot1{$server}{$key}->[0] if (!defined($first)); } print "</tr>\n"; } $key="TOTALS"; printf "<tr><td><b>%-$namewidth.${namewidth}s</b></td>", $key; $first=undef(); foreach $server (@key_order) { print_value($first,$tot1{$server}{$key}->[0],undef(), $tot1{$server}{$key}->[2]); $first=$tot1{$server}{$key}->[0] if (!defined($first)); } print "</tr>\n</table>\n";}sub print_sep{ my ($sep)=@_; print $sep x ($namewidth + (($colwidth+1) * $column_count)+1),"\n";}sub print_value{ my ($first,$value,$count,$flags)=@_; my ($tmp,$width); if (defined($value)) { if (!defined($first) || !$opt_relative) { $tmp=sprintf("%.2f",$value); } else { $first=1 if ($first == 0); # Assume that it took one second instead of 0 $tmp= sprintf("%.2f",$value/$first); } if (defined($flags)) { $tmp="+".$tmp if ($flags =~ /\+/); $tmp="?".$tmp if ($flags =~ /\?/); $tmp="*".$tmp if ($flags =~ /\*/); } } else { $tmp=""; } $width= ($opt_verbose ? $colwidth - $count_width : $colwidth); if (!$opt_html) { $tmp= " " x ($width-length($tmp)) . $tmp if (length($tmp) < $width); } if ($opt_verbose) { if ($count) { $tmp.= ":" . " " x ($count_width-1-length($count)) . $count; } else { $tmp.= " " x ($count_width); } } if (!$opt_html) { print $tmp . "${bar}"; } else { print "<td align=right>$tmp</td>"; }}sub print_string{ my ($str)=@_; if (!$opt_html) { my ($width); $width=$namewidth + ($colwidth+1)*$column_count; $str=substr($str,1,$width) if (length($str) > $width); print($str," " x ($width - length($str)),"${bar}\n"); } else { print $str,"\n"; }}sub usage{ print <<EOF;$0 Ver 1.2This program parses all RUN files from old 'run-all-tests --log' scriptsand makes a nice comparable table.$0 takes currently the following options:--help or --Information Shows this help--cmp=server,server,server (Default $opt_cmp)Compares all runs that are done with the same --cmp options to run-all-tests.The most normal options are '--cmp=mysql,pg,solid' and '--cmp ""'--dir=... (Default $opt_dir)From which directory one should get the runs. All runs made byrun-all-tests --log is saved in the 'output' directory.In the 'results' directory you may have some example runs from differentdatabases.--html Print the table in html format.--machine='full-machine-name' (Default $opt_machine)Use only runs that match this machine.--relativeShow all numbers in times of the first server where the time for thefirst server is 1.0--same-serverCompare all runs for --server=.... The --machine is not used in this caseThis is nice to compare how the same server runs on different machines.--server='server name' (Default $opt_server)Put this server in the first result column.--skip-countDo not write the number of tests after the test-name.--verboseWrite the number of tests in each column. This is useful when some columnis marked with '*'.EOF exit(0);}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -