Bug 470455 - test_database_sync_embed_visits.js leaks, r=sdwilsh
[wine-gecko.git] / tools / performance / startup / printlog.pl
blobc4411166d1e263d1a75af8102af29b37b4bfee64
1 # Post processor for timeline output
2 # Does a diff betn consecutive timeline outputs looking for
3 # big % differences
5 my $percent = 1; # anything over 1% of total is of interest to us
6 my $ignoreDllLoads = 0; # by default don't ignore dll timings
8 # Read in log to memory
9 my @lines = <>;
11 my $total = 0;
12 # Look for main1's timing
13 foreach (@lines) {
14 if (/^([0-9\.]*): \.\.\.main1/) {
15 $total = $1 + 0;
16 print "Found main1 time: $total\n";
17 last;
22 my $prev = 0;
23 my $t = $total * $percent / 100;
24 foreach (@lines) {
25 /^([0-9\.]*):/;
26 $cur = $1;
27 printdiff($cur, $prev, $_);
28 if (/total: ([0-9\.]*)/) {
29 # print how much % this was
30 printf "%4.2f%%", $1/$total*100;
32 print "\t$_";
33 $prev = $cur;
37 sub printdiff() {
38 my $cur = shift;
39 my $prev = shift;
40 my $line = shift;
41 my $diff = $cur - $prev;
43 # Make sure we have a considerable difference
44 if ($diff < $t) {
45 return 0;
48 # If we are ignoring dlls and this is a dll line, return
49 if ($ignoreDllLoads && $line =~ /PR_LoadLibrary/) {
50 return 0;
53 # if significant time elapsed print it
54 printf "%4.2f%% %5.3f\n", $diff/$total*100, $diff;
56 return 1;