diff options
author | mbligh <mbligh@592f7852-d20e-0410-864c-8624ca9c26a4> | 2007-07-10 17:48:36 +0000 |
---|---|---|
committer | mbligh <mbligh@592f7852-d20e-0410-864c-8624ca9c26a4> | 2007-07-10 17:48:36 +0000 |
commit | 656de68687b0da2f9afbbc55270149042939bbb6 (patch) | |
tree | 241ef0bde1822c4cb1bd9b12346f96493d46afc6 /tko/plotgraph | |
parent | a6b01b4945b81afc51ec6a15adac0391b6d0223e (diff) |
add graph plotting tools
Not much use on their own, but might be useful for someone to look at.
Signed-off-by: Martin J. Bligh <mbligh@google.com>
git-svn-id: svn://test.kernel.org/autotest/trunk@555 592f7852-d20e-0410-864c-8624ca9c26a4
Diffstat (limited to 'tko/plotgraph')
-rwxr-xr-x | tko/plotgraph | 77 |
1 files changed, 77 insertions, 0 deletions
diff --git a/tko/plotgraph b/tko/plotgraph new file mode 100755 index 00000000..ecd33bdd --- /dev/null +++ b/tko/plotgraph @@ -0,0 +1,77 @@ +#!/usr/bin/perl +# +# Copyright Martin J. Bligh (mbligh@mbligh.org), 2006 + +($file, $y_label, $columns, $title) = @ARGV; +die unless (-f $file); +die unless ($y_label); +die unless ($columns =~ /^1:\d+/); + +# print " ++++++ plotgraph $file\n"; +plotgraph($file, $y_label, $columns, $title); +# print " ++++++ plotgraph\n"; + +# First column must be kernel count, second kernel version, third is job number +# $columns spec is 1:y-value:y-stddev +sub plotgraph { + my ($file, $y_label, $columns, $title) = @_; + my @xtics; + + if (!$title) { + $title = $file; + $title =~ s#.*/##; + } + open (INDATA, $file); + open (DATA_MAIN, "> ${file}.main"); + open (DATA_MM, "> ${file}.mm"); + open (DATA_OTHER, "> ${file}.other"); + my $count; + while ($data = <INDATA>) { + chomp $data; + ($count, my $version, my $job) = split (/\s+/, $data); + $short_ver = $version; + $short_ver =~ s/\+.*/+p$job/; + push @xtics, "\"$short_ver\" $count"; + if ($version =~ /^2\.\d+\.\d+(\.\d+|-rc\d+)?(-git\d+)?$/) { + print DATA_MAIN "$data\n"; + $plot_main = "\"${file}.main\" using $columns title \"mainline\""; + } elsif ($version =~ /^2\.\d+\.\d+(-rc\d+)?-mm\d+$/) { + print DATA_MM "$data\n"; + $plot_mm = "\"${file}.mm\" using $columns title \"-mm\""; + } else { + print DATA_OTHER "$data\n"; + $plot_other = "\"${file}.other\" using $columns title \"other\""; + } + } + close (INDATA); + close (DATA_MAIN); + close (DATA_MM); + close (DATA_OTHER); + + die unless ($count > 0); + $x_res = $count * 12; + $y_res = 900; + push @plots, $plot_main if ($plot_main); + push @plots, $plot_mm if ($plot_mm); + push @plots, $plot_other if ($plot_other); + $plots = join (',', @plots); + + open (GNUPLOT, "> ${file}.gnuplot"); + # print "MACHINE: $machine\n"; + print GNUPLOT "set terminal png size $x_res,$y_res\n"; + print GNUPLOT "set key below\n"; + print GNUPLOT "set title \"$title\"\n"; + print GNUPLOT "set xlabel \"Kernel\"\n"; + print GNUPLOT "set ylabel \"${y_label}\"\n"; + print GNUPLOT "set output \"${file}.png\"\n"; + print GNUPLOT "set style data yerrorlines\n"; + print GNUPLOT "set grid\n"; + $xtics = join ',', @xtics; + print GNUPLOT "\nset xtics rotate (${xtics})\n\n"; + print GNUPLOT "plot $plots\n"; + print GNUPLOT "replot"; + close (GNUPLOT); + `/usr/bin/gnuplot ${file}.gnuplot`; + `chmod 644 ${file}.gnuplot`; + `chmod 644 ${file}.png`; +} |