michael@0: #!/usr/bin/perl -w michael@0: # This Source Code Form is subject to the terms of the Mozilla Public michael@0: # License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: # file, You can obtain one at http://mozilla.org/MPL/2.0/. michael@0: michael@0: michael@0: %::Sites = (); michael@0: michael@0: @::Categories = ( michael@0: Content, michael@0: Reflow, michael@0: Frame, michael@0: Style, michael@0: Parse, michael@0: DTD, michael@0: Tokenize, michael@0: Total michael@0: ); michael@0: michael@0: $::CurrentSite = ""; michael@0: michael@0: LINE: while (<>) { michael@0: if (/^\*\*\* Timing layout processes on url: '(.*)'/) { michael@0: # This will generate a URL that looks something like: michael@0: # michael@0: # file:///foo/bar/website/index.html michael@0: # michael@0: # So, we'll parse out the ``website'' part... michael@0: my @parts = split('/', $1); michael@0: $::CurrentSite = $parts[$#parts - 1]; michael@0: michael@0: if (! $::Sites{$::CurrentSite}) { michael@0: $::Sites{$::CurrentSite} = {}; michael@0: } michael@0: next LINE; michael@0: } michael@0: michael@0: next LINE unless $::CurrentSite; michael@0: michael@0: CATEGORY: foreach $category (@::Categories) { michael@0: next CATEGORY unless (/$category/); michael@0: michael@0: # The "real time" is indicated in HH:MM:SS.mmmm format michael@0: my ($h,$m,$s,$ms) = /Real time (..):(..):(..)\.(....)/; michael@0: my $real = $ms; michael@0: $real += $s * 1000; michael@0: $real += $m * 1000 * 60; michael@0: $real += $h * 1000 * 60 * 60; michael@0: michael@0: # The "CPU time" is indicated in m.uuu format michael@0: my ($cpu) = /CP time (.*\....)/; michael@0: michael@0: my $site = $::Sites{$::CurrentSite}; michael@0: if (! $site->{$category}) { michael@0: $site->{$category} = { Count => 0, Real => 0, CPU => 0, Real2 => 0, CPU2 => 0 }; michael@0: } michael@0: michael@0: $site->{$category}->{Count} += 1; michael@0: $site->{$category}->{Real} += $real; michael@0: $site->{$category}->{CPU} += $cpu; michael@0: $site->{$category}->{Real2} += $real * $real; michael@0: $site->{$category}->{CPU2} += $cpu * $cpu; michael@0: } michael@0: } michael@0: michael@0: my $bgcolor0 = '#999999'; michael@0: my $bgcolor1 = '#777777'; michael@0: michael@0: my $bgcolor; michael@0: michael@0: print "
Site | \n"; michael@0: michael@0: $bgcolor = $bgcolor0; michael@0: foreach $category (@::Categories) { michael@0: print "$category | \n"; michael@0: $bgcolor = ($bgcolor eq $bgcolor0) ? $bgcolor1 : $bgcolor0; michael@0: } michael@0: print "|||
CPU | Real | \n"; michael@0: $bgcolor = ($bgcolor eq $bgcolor0) ? $bgcolor1 : $bgcolor0; michael@0: } michael@0: print "|||
$sitename | \n"; michael@0: michael@0: $bgcolor = $bgcolor0; michael@0: foreach $category (@::Categories) { michael@0: my $count = $site->{$category}->{Count}; michael@0: my $real = $site->{$category}->{Real}; michael@0: my $cpu = $site->{$category}->{CPU}; michael@0: my $real2 = $site->{$category}->{Real2}; michael@0: my $cpu2 = $site->{$category}->{CPU2}; michael@0: michael@0: my $realdev = 0; michael@0: my $cpudev = 0; michael@0: michael@0: if ($count) { michael@0: if ($count > 1) { michael@0: $realdev = sqrt( ( $real2 * $count - $real * $real ) / ( $count * ( $count - 1 ) ) ); michael@0: $cpudev = sqrt( ( $cpu2 * $count - $cpu * $cpu ) / ( $count * ( $count - 1 ) ) ); michael@0: } michael@0: michael@0: $real /= $count; michael@0: $cpu /= $count; michael@0: } michael@0: else { michael@0: $count = 0; michael@0: $real = 0; michael@0: $cpu = 0; michael@0: } michael@0: michael@0: printf "%0.2lf | ±%0.2lf | \n", $cpu, $cpudev; michael@0: printf "%0.2lf | ±%0.2lf | ", $real, $realdev; michael@0: michael@0: $bgcolor = ($bgcolor eq $bgcolor0) ? $bgcolor1 : $bgcolor0; michael@0: } michael@0: michael@0: print "