From: Michal Sojka Date: Wed, 16 Feb 2011 12:27:56 +0000 (+0100) Subject: Add script to convert CANalyzer logs to gnuplot-friendly histograms X-Git-Tag: fix-allnoconfig~194 X-Git-Url: http://rtime.felk.cvut.cz/gitweb/can-benchmark.git/commitdiff_plain/a009a91c2e833e279e4c9cb9116ae4a4d4a20b50?hp=037852ddff6486e084b6524a2fb9f5320268aabd Add script to convert CANalyzer logs to gnuplot-friendly histograms --- diff --git a/gw-tests/canalyzer/convall.pl b/gw-tests/canalyzer/convall.pl new file mode 100755 index 0000000..62d3082 --- /dev/null +++ b/gw-tests/canalyzer/convall.pl @@ -0,0 +1,40 @@ +#!/usr/bin/perl -w + +foreach $l(`find ../results -name '*.log'`) { + chomp $l; + $t = $l; + $t =~ s/.log$/.txt/; + system("./mdfconv $l > $t"); + + my %hist = (); + open(my $fh, '<', $t); + while (<$fh>) { + next if /^#/; + chomp; + @l1 = split / /, $_; + $_ = <$fh>; + chomp; + @l2 = split / /, $_; + + $time10us = $l2[14]-$l1[14]; +# if (exists $hist{$time10us}) { + $hist{$time10us} += 1; +# } else { +# $hist{$time10us} = 1; +# } + } + $cum = 0; + foreach $t(reverse(sort {$a <=> $b} keys(%hist))) { + $cum += $hist{$t}; + $hist{$t} = $cum; + } + + $h=$t; + $h =~ s/.txt$/-hist.txt/; + open(my $fhout, '>', $h); + print "$h\n"; + foreach $t(sort {$a <=> $b} keys(%hist)) { + printf $fhout "%g %d\n", $t/100.0, $hist{$t}; + } +} +exit 0