xref: /glogg/tools/perfmeter.pl (revision d0deb8b418a07e6bf0c5f7cc803ebd9dfbe35f27)
1257f352aSNicolas Bonnefon#!/usr/bin/perl
2257f352aSNicolas Bonnefon
3257f352aSNicolas Bonnefon# Take a debug log from logcrawler and output some perf statistics
4948fb2faSNicolas Bonnefon# Can be plotted by echo "plot [ ] [0:0.1] 'foo.data'; pause mouse key;" | gnuplot -
5257f352aSNicolas Bonnefon
6*d0deb8b4SNicolas Bonnefon# Or an histogram:
7*d0deb8b4SNicolas Bonnefon# plot './qvector.data' using ((floor($1/50)+0.5)*50):(1) smooth frequency w histeps, './qvar_default.data' using ((floor($1/50)+0.5)*50):(1) smooth frequency w histeps, './qvar_50000.data' using ((floor($1/50)+0.5)*50):(1) smooth frequency w histeps
8*d0deb8b4SNicolas Bonnefon# Better: plot './0.6.0-3.data' using ((floor($1/0.005)+0.1)*0.005):(0.1) smooth frequency w histeps
9*d0deb8b4SNicolas Bonnefon
10257f352aSNicolas Bonnefonwhile (<>) {
11257f352aSNicolas Bonnefon    strip;
12257f352aSNicolas Bonnefon    if (/(\d\d\.\d\d\d) DEBUG: paintEvent.*firstLine=(\d+) lastLine=(\d+) /) {
13257f352aSNicolas Bonnefon        if ( ($3 - $2) > 35 ) {
14257f352aSNicolas Bonnefon            $beginning = $1;
15257f352aSNicolas Bonnefon            $first_line = $2;
16257f352aSNicolas Bonnefon        }
17257f352aSNicolas Bonnefon    }
18257f352aSNicolas Bonnefon    elsif (/(\d\d\.\d\d\d) DEBUG: End/) {
19257f352aSNicolas Bonnefon        if ($beginning) {
20257f352aSNicolas Bonnefon            $time = $1 - $beginning;
21*d0deb8b4SNicolas Bonnefon            # print "$first_line $time\n";
22*d0deb8b4SNicolas Bonnefon            if ($time > 0) {
23*d0deb8b4SNicolas Bonnefon                print "$time\n";
24*d0deb8b4SNicolas Bonnefon            }
25257f352aSNicolas Bonnefon        }
26257f352aSNicolas Bonnefon    }
27257f352aSNicolas Bonnefon}
28