Home | History | Annotate | Download | only in tko
      1 #!/usr/bin/perl 
      2 # 
      3 # Copyright Martin J. Bligh (mbligh (at] mbligh.org), 2006
      4 
      5 $bin = `realpath $0 | xargs dirname`; chomp $bin;
      6 require "$bin/abat_parse.pm";
      7 
      8 $plotgraph = "$bin/plotgraph";
      9 
     10 $perfdir = shift(@ARGV);
     11 die unless (-d $perfdir);
     12 
     13 opendir PERFDIR, $perfdir;
     14 my @data_files = grep /^plotdata\.[\w-]+\.[\w-]+$/, readdir PERFDIR;
     15 closedir PERFDIR;
     16 chdir ($perfdir);
     17 
     18 %axis_labels = (    'kernbench'    => 'Elapsed time (seconds)',
     19             'dbench'    => 'Throughput (MB/s)',
     20             'tbench'    => 'Throughput (MB/s)',
     21             'reaim'        => 'Max Jobs per Minute',
     22         );
     23 
     24 %plot_cols = (        'kernbench'    => '1:4:8',
     25             'dbench'    => '1:4:5',
     26             'tbench'    => '1:4:5',
     27             'reaim'        => '1:4:5',
     28         );
     29             
     30 foreach $data_file (@data_files) {
     31     $data_file =~ /^plotdata\.([\w-]+)\.([\w-]+)$/;
     32     ($test, $machine) = ($1, $2);
     33     print " === Analysing data file: $data_file $test $machine\n";
     34     push @machines, $machine;
     35     open DATAFILE, $data_file || die "Cannot open $data_file";
     36     while ($data = <DATAFILE>) {
     37         print "X " . $data;
     38         chomp $data;
     39         $data =~ s/^\d+\s+//; #  get rid of count
     40         @data = split (/ /, $data);
     41         $version = $data[0];
     42         print "$test $version = $data\n";
     43         $results{$test}{$machine}{$version} = $data;
     44         push @versions, $version;
     45     }
     46 }
     47 
     48 @machines = list_uniq (@machines);
     49 @versions = sort version list_uniq (@versions);
     50 
     51 @relevant = relevant_versions(@versions);
     52 
     53 foreach $machine (@machines) {
     54     foreach $test (keys(%axis_labels)) {
     55         graph_plot($machine, "${test}.full.${machine}",
     56                 $test, @versions);
     57         graph_plot($machine, "${test}.${machine}",
     58                 $test, @relevant);
     59     }
     60 }
     61 
     62 sub graph_plot
     63 {
     64     my ($machine, $filename, $test, @plot_versions) = @_;
     65     my $count = 0;
     66 
     67     print " ----- test: $test machine: $machine $#plot_versions\n";
     68     open (DATA, "> $filename") || die "Cannot open data file $filename";
     69     foreach $version (@plot_versions) {
     70         my $results = $results{$test}{$machine}{$version};
     71         next unless ($results =~ /\S/);
     72         $count++;
     73         print "$count $version $results\n";
     74         print DATA "$count $results\n";
     75     }
     76     close (DATA);
     77     print " ----- \n";
     78     print `$plotgraph $filename '$axis_labels{$test}' '$plot_cols{$test}'`;
     79 }
     80 
     81