⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 graph-compare-results

📁 开启mysql的远程连接的方法 mysql-noinstall-5.1.6-alpha-win32.zip
💻
📖 第 1 页 / 共 2 页
字号:
######## Hello ... this is a heavily hacked script by Luuk #### instead of printing the result it makes a nice gif#### when you want to look at the code ... beware of the #### ugliest code ever seen .... but it works ...#### and that's sometimes the only thing you want ... isn't it ...#### as the original script ... Hope you like it######## Greetz..... Luuk de Boer 1997.###### if you want the seconds behind the bar printed or not ...## or only the one where the bar is too big for the graph ...## look at line 535 of this program and below ...## look in sub calculate for allmost all hard/soft settings :-)# a little program to generate a table of results# just read all the RUN-*.log files and format them nicely# Made by Luuk de Boer# Patched by Montyuse Getopt::Long;use GD;$opt_server="mysql";$opt_cmp="mysql,pg,solid";$opt_cmp="msql,mysql,pg,solid";$opt_cmp="empress,mysql,pg,solid";$opt_dir="output";$opt_machine="";$opt_relative=$opt_same_server=$opt_help=$opt_Information=$opt_skip_count=0;GetOptions("Information","help","server=s","cmp=s","machine=s","relative","same-server","dir=s","skip-count") || usage();usage() if ($opt_help || $opt_Information);if ($opt_same_server){  $files="$opt_dir/RUN-$opt_server-*$opt_machine";}else{  $files="$opt_dir/RUN-*$opt_machine";}$files.= "-cmp-$opt_cmp" if (length($opt_cmp));$automatic_files=0;if ($#ARGV == -1){  @ARGV=glob($files);  $automatic_files=1;}## Go trough all RUN files and gather statistics.#foreach (@ARGV){  $filename = $_;  next if (defined($found{$_})); # remove duplicates  $found{$_}=1;  /RUN-(.*)$/;  $prog = $1;  push(@key_order,$prog);  $next = 0;  open(TMP, "<$filename") || die "Can't open $filename: $!\n";  while (<TMP>)  {    chomp;    if ($next == 0) {      if (/Server version:\s+(\S+.*)/i)      {	$tot{$prog}{'server'} = $1;      }      elsif (/Arguments:\s+(.+)/i)      {	$tot{$prog}{'arguments'} = $1;	# Remove some standard, not informative arguments	$tot{$prog}{'arguments'} =~ s/--log|--use-old-results|--server=\S+|--cmp=\S+|--user=\S+|--pass=\S+|--machine=\S+//g;	$tot{$prog}{'arguments'} =~ s/\s+/ /g;      }      elsif (/Comments:\s+(.+)/i) {	$tot{$prog}{'comments'} = $1;      } elsif (/^(\S+):\s*(estimated\s|)total\stime:\s+(\d+)\s+secs/i)      {	$tmp = $1; $tmp =~ s/://;	$tot{$prog}{$tmp} = [ $3, (length($2) ? "+" : "")];	$op1{$tmp} = $tmp;      } elsif (/Totals per operation:/i) {	$next = 1;	next;      }    }    elsif ($next == 1)    {      if (/^(\S+)\s+([\d.]+)\s+([\d.]+)\s+([\d.]+)\s+([\d.]+)\s+([\d.]+)\s*([+|?])*/)      {	$tot1{$prog}{$1} = [$2,$6,$7];	$op{$1} = $1;#print "TEST - $_ \n * $prog - $1 - $2 - $6 - $7 ****\n";# $prog - filename# $1 - operation# $2 - time in secs# $6 - number of loops# $7 - nothing / + / ? / * => estimated time ...      # get the highest value ....      $highest = ($2/$6) if (($highest < ($2/$6)) && ($1 !~/TOTALS/i));      $gifcount++;      $giftotal += ($2/$6);      }    }  }}if (!%op){  print "Didn't find any files matching: '$files'\n";  print "Use the --cmp=server,server option to compare benchmarks\n";  exit 1;}# everything is loaded ...# now we have to create a fancy output :-)# I prefer to redirect scripts instead to force it to file ; Monty## open(RES, ">$resultfile") || die "Can't write to $resultfile: $!\n";# select(RES)##print <<EOF;#<cut for this moment>##EOFif ($opt_relative){#  print "Column 1 is in seconds. All other columns are presented relative\n";#  print "to this. 1.00 is the same, bigger numbers indicates slower\n\n";}#print "The result logs which where found and the options:\n";if ($automatic_files){  if ($key_order[$i] =~ /^$opt_server/)  {    if ($key_order[$i] =~ /^$opt_server/)    {      unshift(@key_order,$key_order[$i]);      splice(@key_order,$i+1,1);    }  }}# extra for mysql and mysql_pgcc#$number1 = shift(@key_order);#$number2 = shift(@key_order);#unshift(@key_order,$number1);#unshift(@key_order,$number2);# Print header$column_count=0;foreach $key (@key_order){  $column_count++;#  printf "%2d %-40.40s: %s %s\n", $column_count, $key,#  $tot{$key}{'server'}, $tot{$key}{'arguments'};#  print "Comments: $tot{$key}{'comments'}\n"#    if ($tot{$key}{'comments'} =~ /\w+/);}#print "\n";$namewidth=$opt_skip_count ? 20 :25;$colwidth= $opt_relative ? 9 : 6;print_sep("=");#printf "%-$namewidth.${namewidth}s|", "Operation";$count = 1;foreach $key (@key_order){#  printf "%${colwidth}d|", $count;  $count++;}#print "\n";#print_sep("-");#print_string("Results per test:");#print_sep("-");foreach $key (sort {$a cmp $b} keys %op1){#  printf "%-$namewidth.${namewidth}s|", $key;  $first=undef();  foreach $server (@key_order)  {    print_value($first,$tot{$server}{$key}->[0],$tot{$server}{$key}->[1]);    $first=$tot{$server}{$key}->[0] if (!defined($first));  }#  print "\n";}print_sep("-");print_string("The results per operation:");print_sep("-");$luukcounter = 1;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);#  printf "%-$namewidth.${namewidth}s|", $tmp;  $first=undef();  foreach $server (@key_order)  {    print_value($first,$tot1{$server}{$key}->[0],$tot1{$server}{$key}->[2]);    $first=$tot1{$server}{$key}->[0] if (!defined($first));  }#  print "\n";  $luukcounter++;}#print_sep("-");$key="TOTALS";#printf "%-$namewidth.${namewidth}s|", $key;$first=undef();foreach $server (@key_order){#  print_value($first,$tot1{$server}{$key}->[0],$tot1{$server}{$key}->[2]);  $first=$tot1{$server}{$key}->[0] if (!defined($first));}#print "\n";#print_sep("=");&make_gif;exit 0;## some format functions;#sub print_sep{  my ($sep)=@_;#  print $sep x ($namewidth + (($colwidth+1) * $column_count)+1),"\n";}sub print_value{  my ($first,$value,$flags)=@_;  my ($tmp);  if (defined($value))  {    if (!defined($first) || !$opt_relative)    {      $tmp=sprintf("%d",$value);    }    else    {      $first=1 if (!$first);	# 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 =~ /\?/);    }  }  else  {    $tmp="";  }  $tmp= " " x ($colwidth-length($tmp)) . $tmp if (length($tmp) < $colwidth);#  print $tmp . "|";}sub print_string{  my ($str)=@_;  my ($width);  $width=$namewidth + ($colwidth+1)*$column_count;  $str=substr($str,1,$width) if (length($str) > $width);#  print($str," " x ($width - length($str)),"|\n");}sub usage{  exit(0);}################################################################################################################################## making here a gif of the results ... (lets try it :-))# luuk .... 1997############################################# take care that $highest / $giftotal / $gifcount / $luukcounter ## are getting there value above ... so don't forget them while ## copying the code to some other program ....sub make_gif {  &gd; # some base things ....  &legend; # make the nice legend  &lines; # yep sometimes you have to print some lines  &gif("gif/benchmark2-".$opt_cmp); # and finally we can print all to a gif file ...}##### mmm we are finished now ... # first we have to calculate some limits and some other stuffsub calculate {# here is the list which I have to know to make everything .....# the small border width ... 					$sm_border = # the border default						$border = # the step default ... if it must be calculated then no value	$step =# the highest number						$highest = # the max length of the text of the x borders			$max_len_lb=# the max length of a legend entry				$max_len_le=# number of entries in the legend				$num_legen =# the length of the color blocks for the legend			$legend_block=# the width of the gif ...if it must be calculated - no value   $width =# the height of the gif .. if it must be calculated - no value	$height =

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -