From 27d315164969706e7afe9226f4555a11ed0b0a3f Mon Sep 17 00:00:00 2001 From: "attinasi%netscape.com" Date: Fri, 2 Jun 2000 00:53:52 +0000 Subject: [PATCH] New script for down-and-dirty collection of performance data (author:waterson). --- tools/performance/layout/collect.pl | 130 ++++++++++++++++++++++++++++ 1 file changed, 130 insertions(+) create mode 100644 tools/performance/layout/collect.pl diff --git a/tools/performance/layout/collect.pl b/tools/performance/layout/collect.pl new file mode 100644 index 000000000000..c86fca702de6 --- /dev/null +++ b/tools/performance/layout/collect.pl @@ -0,0 +1,130 @@ +#!/usr/bin/perl -w + +%::Sites = (); + +@::Categories = ( + Content, + Reflow, + Frame, + Style, + Parse, + DTD, + Tokenize, + Total + ); + +$::CurrentSite = ""; + +LINE: while (<>) { + if (/^\*\*\* Timing layout processes on url: '(.*)'/) { + # This will generate a URL that looks something like: + # + # file:///foo/bar/website/index.html + # + # So, we'll parse out the ``website'' part... + my @parts = split('/', $1); + $::CurrentSite = $parts[$#parts - 1]; + + if (! $::Sites{$::CurrentSite}) { + $::Sites{$::CurrentSite} = {}; + } + next LINE; + } + + next LINE unless $::CurrentSite; + + CATEGORY: foreach $category (@::Categories) { + next CATEGORY unless (/$category/); + + # The "real time" is indicated in HH:MM:SS.mmmm format + my ($h,$m,$s,$ms) = /Real time (..):(..):(..)\.(....)/; + my $real = $ms; + $real += $s * 1000; + $real += $m * 1000 * 60; + $real += $h * 1000 * 60 * 60; + + # The "CPU time" is indicated in m.uuu format + my ($cpu) = /CP time (.*\....)/; + + my $site = $::Sites{$::CurrentSite}; + if (! $site->{$category}) { + $site->{$category} = { Count => 0, Real => 0, CPU => 0, Real2 => 0, CPU2 => 0 }; + } + + $site->{$category}->{Count} += 1; + $site->{$category}->{Real} += $real; + $site->{$category}->{CPU} += $cpu; + $site->{$category}->{Real2} += $real * $real; + $site->{$category}->{CPU2} += $cpu * $cpu; + } +} + +my $bgcolor0 = '#999999'; +my $bgcolor1 = '#777777'; + +my $bgcolor; + +print "\n"; + +print "\n"; +print " \n"; + +$bgcolor = $bgcolor0; +foreach $category (@::Categories) { + print " \n"; + $bgcolor = ($bgcolor eq $bgcolor0) ? $bgcolor1 : $bgcolor0; +} +print "\n"; + +print "\n"; + +$bgcolor = $bgcolor0; +foreach $category (@::Categories) { + print " \n"; + $bgcolor = ($bgcolor eq $bgcolor0) ? $bgcolor1 : $bgcolor0; +} +print "\n"; + +foreach $sitename (sort(keys(%::Sites))) { + print "\n"; + + my $site = $::Sites{$sitename}; + print " \n"; + + $bgcolor = $bgcolor0; + foreach $category (@::Categories) { + my $count = $site->{$category}->{Count}; + my $real = $site->{$category}->{Real}; + my $cpu = $site->{$category}->{CPU}; + my $real2 = $site->{$category}->{Real2}; + my $cpu2 = $site->{$category}->{CPU2}; + + my $realdev = 0; + my $cpudev = 0; + + if ($count) { + if ($count > 1) { + $realdev = sqrt( ( $real2 * $count - $real * $real ) / ( $count * ( $count - 1 ) ) ); + $cpudev = sqrt( ( $cpu2 * $count - $cpu * $cpu ) / ( $count * ( $count - 1 ) ) ); + } + + $real /= $count; + $cpu /= $count; + } + else { + $count = 0; + $real = 0; + $cpu = 0; + } + + printf " \n", $cpu, $cpudev; + printf " ", $real, $realdev; + + $bgcolor = ($bgcolor eq $bgcolor0) ? $bgcolor1 : $bgcolor0; + } + + print "\n"; +} + +print "
Site$category
CPU Real
$sitename%0.2lf±%0.2lf%0.2lf±%0.2lf
\n"; +