[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-devel] [PATCH 17/27] ts-kernbench-reslts: process and plot bench results



From: Dario Faggioli <raistlin@xxxxxxxx>

Extract the data from the output of kernbench and produce
the tables, the gnuplot script and the plots.

All is saved in $stash, for the running flight and job.

Signed-off-by: Dario Faggioli <dario.faggioli@xxxxxxxxxx>
Cc: Wei Liu <wei.liu2@xxxxxxxxxx>
Cc: Ian Campbell <Ian.Campbell@xxxxxxxxxx>
Cc: Ian Jackson <Ian.Jackson@xxxxxxxxxxxxx>
---
 Osstest/Benchmarking.pm |   88 ++++++++++++++++++++++++++++++++++++++++++++---
 ts-kernbench-reslts     |   19 +++++++++-
 2 files changed, 99 insertions(+), 8 deletions(-)

diff --git a/Osstest/Benchmarking.pm b/Osstest/Benchmarking.pm
index 0c5c538..ff45766 100644
--- a/Osstest/Benchmarking.pm
+++ b/Osstest/Benchmarking.pm
@@ -34,6 +34,9 @@ BEGIN {
     @EXPORT      = qw(unixbench_process_results
                       unixbench_print_results
                       unixbench_plot_results
+                      kernbench_process_results
+                      kernbench_print_results
+                      kernbench_plot_results
                       );
     %EXPORT_TAGS = ( );
 
@@ -83,6 +86,15 @@ sub unixbench_print_results ($$) {
   close($h);
 }
 
+our $common_plot_opts= <<EOF;
+set key outside center top horizontal noreverse noenhanced autotitles nobox
+set xtics mirror rotate by -45 out
+set style data histogram
+set style histogram cluster gap 1
+set style fill solid border lt -1
+set boxwidth 1 absolute
+EOF
+
 sub unixbench_plot_results ($$$) {
   my ($dataf,$num_cols,$pfile)= @_;
   my $h= new IO::File "> $pfile.gp" or die "$!";
@@ -91,12 +103,7 @@ sub unixbench_plot_results ($$$) {
 set terminal png enhanced font 
"/usr/share/fonts/truetype/ttf-dejavu/DejaVuSans.ttf" 8 size 800,600
 set output '$pfile.png'
 set title 'Unixbench INDEXes for $flight.$job'
-set key outside center top horizontal noreverse noenhanced autotitles nobox
-set xtics mirror rotate by -45 out
-set style data histogram
-set style histogram cluster gap 1
-set style fill solid border lt -1
-set boxwidth 1 absolute
+$common_plot_opts
 set bmargin 13
 set rmargin 14
 SKIP_COL=1
@@ -112,4 +119,73 @@ EOF
   logm("WARNING: plotting file with \"$err\"") unless $ok;
 }
 
+sub kernbench_process_results ($$) {
+  my ($results_ref,$rfilen)= @_;
+  my $h= new IO::File "< $rfilen" or die "$!";
+
+  my $run;
+  while (<$h>) {
+    my ($bench,$val,$stdd);
+    if (m/.*load -j ([0-9]*)\s?Run.*$/) {
+      $run= $1 || 0;
+    }
+    if (m/^(\S[a-zA-z\s]*)\s([0-9]+.?[0-9]*)\s\(([0-9]+.?[0-9]*)\)$/) {
+      $bench=$1;
+      next if $bench =~ /Sleeps|Context|Percent/;
+      $val= $2;
+      $stdd= $3;
+      $$results_ref->{"$bench"}{Result}{"$run"}= $val;
+      $$results_ref->{"$bench"}{StdDev}{"$run"}= $stdd;
+    }
+    next;
+  }
+  close($h);
+}
+
+sub kernbench_print_results ($$) {
+  my ($results,$rfilen)= @_;
+  open my $h, "|-", "tee $rfilen" or die "$!";
+
+  printf $h "%-25s","\"What\"";
+  foreach my $i (sort keys $results->{'Elapsed Time'}{'Result'}) {
+    my $col= "kernbench -j";
+    $col .= ($i == 0) ? "" : " $i";
+    printf $h "%-20s","\"$col\""
+    # TODO: Include stddev too in the report
+  }
+  print $h "\n";
+  foreach my $b (keys $results) {
+    printf $h "%-25s","\"$b\"";
+    foreach my $i (sort keys $results->{"$b"}{'Result'}) {
+      printf $h "%-20s",$results->{$b}{'Result'}{$i};
+    }
+    print $h "\n";
+  }
+  close($h);
+}
+
+sub kernbench_plot_results ($$$) {
+  my ($dataf,$num_cols,$pfile)= @_;
+
+  my $h= new IO::File "> $pfile.gp" or die "$!";
+  print $h <<EOF;
+set terminal png enhanced font 
"/usr/share/fonts/truetype/ttf-dejavu/DejaVuSans.ttf" 8 size 800,600
+set output '$pfile.png'
+set title 'Kernbench Results for $flight.$job'
+$common_plot_opts
+set bmargin 6
+SKIP_COL=1
+NCOL=$num_cols
+HWIDTH=1.0/(NCOL+1.0)
+cols=''
+plot for [c=SKIP_COL+1:SKIP_COL+NCOL] '$dataf' using c:xtic(1) with histograms 
title columnhead, \\
+        for [c=SKIP_COL+1:SKIP_COL+NCOL] '' every ::1 using 0:c:c with labels 
notitle offset first -HWIDTH*(NCOL/2.0)+HWIDTH/2.0+(c-(SKIP_COL+1))*HWIDTH, 
character 2 rotate by 90
+EOF
+  close($h);
+
+  my $gp= can_run('gnuplot') or return;
+  my ($ok,$err)= run( command => "$gp $pfile.gp", verbose => 1 );
+  logm("WARNING: plotting file with \"$err\"") unless $ok;
+}
+
 1;
diff --git a/ts-kernbench-reslts b/ts-kernbench-reslts
index dcb279d..113a4ce 100755
--- a/ts-kernbench-reslts
+++ b/ts-kernbench-reslts
@@ -21,6 +21,7 @@ use DBI;
 use IO::File;
 use POSIX;
 use Osstest::TestSupport;
+use Osstest::Benchmarking;
 
 tsreadconfig();
 
@@ -43,9 +44,11 @@ $lresfile .= (defined($r{'kernbench_run_suffix'})) ?
       $r{'kernbench_run_suffix'} : '';
 $lresfile = "kernbench$lresfile";
 
+our $results;
+
 # Kernbench stores results in the linux kernel tree it
 # built, in a file called kernbench.log
-sub results() {
+sub fetch() {
   my $rresults_dir= "/root/linux-kernbench";
   my $rresfile= "$rresults_dir/kernbench.log";
 
@@ -57,4 +60,16 @@ sub results() {
       "$lresfile");
 }
 
-results();
+sub process () {
+  my $resf= "$stash/$gho->{Name}--$lresfile";
+  my $dataf= "$resf-DATA";
+  my $plotf= "$resf-PLOT";
+
+  kernbench_process_results(\$results,$resf);
+  kernbench_print_results($results,$dataf);
+  my $ncols= keys $results->{'Elapsed Time'}{'Result'};
+  kernbench_plot_results($dataf,$ncols,$plotf);
+}
+
+fetch();
+process();


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.