[cairo] perf results to SVG script
Vladimir Vukicevic
vladimirv at gmail.com
Thu Sep 14 13:30:36 PDT 2006
Howdy,
I just pushed a change in the output format for the cairo-perf tests.
Attached is a simple perl script to take the output and to turn it
into a (very simple, not very useful right now) SVG file. I'm passing
this along since it might be useful for someone who wants to turn it
into something more, because I doubt I'll have time to improve it any
time soon.
It draws one line per backend, with the X axis representing the test
number, and the Y axis representing the value in milliseconds. There
is no legend or axes anything useful like that :)
Because there is a wide variation in test result values (e.g. the
large tesselator test is a few hundred times slower than most of the
rest of the tests), the scale isn't that useful -- a better approach
might be to allow for picking one backend as a baseline, and then
graphing the rest in relation to that, to visualize speed differences
between backends.
- Vlad
-------------- next part --------------
#!/bin/perl
my $test_data = {};
# skip
my $first = <>;
my $minnum = -1.0;
my $maxnum = 0.0;
my $numtests = 0;
while (<>) {
next unless /^\[ *([0-9]*)\] *([^ ]*) *([^ ]*) *([0-9.]*) *([0-9.]*)%/;
my ($tnum, $backend, $test, $meanms, $stddev) = ($1, $2, $3, $4, $5);
$test_data->{$backend}->{$tnum} = $meanms;
$numtests = $tnum+1 if ($tnum >= $numtests);
$minnum = $meanms if ($minnum < 0.0 || $minnum > $meanms);
$maxnum = $meanms if ($maxnum < $meanms);
}
my $scaledelta = (($minnum + $maxnum) / 2) * 0.1;
my $scalemin = $minnum + $scaledelta;
my $scalemax = $maxnum + $scaledelta;
my $height = 200;
my $width = 10 * ($numtests + 2);
my $scale = $height / ($scalemax - $scalemin);
print <<EOD
<?xml version="1.0"?>
<svg xmlns="http://www.w3.org/2000/svg" width="$width" height="$height">
<g transform="translate(0,$height) scale(1,$scale)">
EOD
;
my @colors = ("red", "green", "blue", "black");
my $cindex = 0;
foreach my $backend (keys %$test_data) {
my $color = $colors[$cindex % ($#colors+1)];
print " <path style=\"stroke: $color\" stroke-width=\"2\" fill=\"none\" d=\"M0,0 L";
for (my $i = 0; $i < $numtests; $i++) {
my $x = $i * 10;
my $y = $test_data->{$backend}->{$i};
print "$x,-$y ";
}
print "\"/>\n";
$cindex++;
}
print <<EOD
</g>
</svg>
EOD
;
More information about the cairo
mailing list