summaryrefslogtreecommitdiff
path: root/tko/draw_graphs
blob: 9ad4f89aa794e88dc4305462cc02b364885507d6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
#!/usr/bin/perl 
# 
# Copyright Martin J. Bligh (mbligh@mbligh.org), 2006

$bin = `realpath $0 | xargs dirname`; chomp $bin;
require "$bin/abat_parse.pm";

$plotgraph = "$bin/plotgraph";

$perfdir = shift(@ARGV);
die unless (-d $perfdir);

opendir PERFDIR, $perfdir;
my @data_files = grep /^plotdata\.[\w-]+\.[\w-]+$/, readdir PERFDIR;
closedir PERFDIR;
chdir ($perfdir);

%axis_labels = (	'kernbench'	=> 'Elapsed time (seconds)',
			'dbench'	=> 'Throughput (MB/s)',
			'tbench'	=> 'Throughput (MB/s)',
			'reaim'		=> 'Max Jobs per Minute',
		);

%plot_cols = (		'kernbench'	=> '1:4:8',
			'dbench'	=> '1:4:5',
			'tbench'	=> '1:4:5',
			'reaim'		=> '1:4:5',
		);
			
foreach $data_file (@data_files) {
	$data_file =~ /^plotdata\.([\w-]+)\.([\w-]+)$/;
	($test, $machine) = ($1, $2);
	print " === Analysing data file: $data_file $test $machine\n";
	push @machines, $machine;
	open DATAFILE, $data_file || die "Cannot open $data_file";
	while ($data = <DATAFILE>) {
		print "X " . $data;
		chomp $data;
		$data =~ s/^\d+\s+//; #  get rid of count
		@data = split (/ /, $data);
		$version = $data[0];
		print "$test $version = $data\n";
		$results{$test}{$machine}{$version} = $data;
		push @versions, $version;
	}
}

@machines = list_uniq (@machines);
@versions = sort version list_uniq (@versions);

@relevant = relevant_versions(@versions);

foreach $machine (@machines) {
	foreach $test (keys(%axis_labels)) {
		graph_plot($machine, "${test}.full.${machine}",
				$test, @versions);
		graph_plot($machine, "${test}.${machine}",
				$test, @relevant);
	}
}

sub graph_plot
{
	my ($machine, $filename, $test, @plot_versions) = @_;
	my $count = 0;

	print " ----- test: $test machine: $machine $#plot_versions\n";
	open (DATA, "> $filename") || die "Cannot open data file $filename";
	foreach $version (@plot_versions) {
		my $results = $results{$test}{$machine}{$version};
		next unless ($results =~ /\S/);
		$count++;
		print "$count $version $results\n";
		print DATA "$count $results\n";
	}
	close (DATA);
	print " ----- \n";
	print `$plotgraph $filename '$axis_labels{$test}' '$plot_cols{$test}'`;
}