Bug 470455 - test_database_sync_embed_visits.js leaks, r=sdwilsh
[wine-gecko.git] / tools / performance / layout / collect.pl
blobc86fca702de6396b940beeedc328f3896a6a9f75
1 #!/usr/bin/perl -w
3 %::Sites = ();
5 @::Categories = (
6 Content,
7 Reflow,
8 Frame,
9 Style,
10 Parse,
11 DTD,
12 Tokenize,
13 Total
16 $::CurrentSite = "";
18 LINE: while (<>) {
19 if (/^\*\*\* Timing layout processes on url: '(.*)'/) {
20 # This will generate a URL that looks something like:
22 # file:///foo/bar/website/index.html
24 # So, we'll parse out the ``website'' part...
25 my @parts = split('/', $1);
26 $::CurrentSite = $parts[$#parts - 1];
28 if (! $::Sites{$::CurrentSite}) {
29 $::Sites{$::CurrentSite} = {};
31 next LINE;
34 next LINE unless $::CurrentSite;
36 CATEGORY: foreach $category (@::Categories) {
37 next CATEGORY unless (/$category/);
39 # The "real time" is indicated in HH:MM:SS.mmmm format
40 my ($h,$m,$s,$ms) = /Real time (..):(..):(..)\.(....)/;
41 my $real = $ms;
42 $real += $s * 1000;
43 $real += $m * 1000 * 60;
44 $real += $h * 1000 * 60 * 60;
46 # The "CPU time" is indicated in m.uuu format
47 my ($cpu) = /CP time (.*\....)/;
49 my $site = $::Sites{$::CurrentSite};
50 if (! $site->{$category}) {
51 $site->{$category} = { Count => 0, Real => 0, CPU => 0, Real2 => 0, CPU2 => 0 };
54 $site->{$category}->{Count} += 1;
55 $site->{$category}->{Real} += $real;
56 $site->{$category}->{CPU} += $cpu;
57 $site->{$category}->{Real2} += $real * $real;
58 $site->{$category}->{CPU2} += $cpu * $cpu;
62 my $bgcolor0 = '#999999';
63 my $bgcolor1 = '#777777';
65 my $bgcolor;
67 print "<table border='0' cellpadding='2' cellspacing='0'>\n";
69 print "<tr>\n";
70 print " <td rowspan='2' valign='bottom'>Site</td>\n";
72 $bgcolor = $bgcolor0;
73 foreach $category (@::Categories) {
74 print " <td bgcolor='$bgcolor' align='center' colspan='4'>$category</td>\n";
75 $bgcolor = ($bgcolor eq $bgcolor0) ? $bgcolor1 : $bgcolor0;
77 print "</tr>\n";
79 print "<tr>\n";
81 $bgcolor = $bgcolor0;
82 foreach $category (@::Categories) {
83 print " <td bgcolor='$bgcolor' align='center' colspan='2'>CPU</td> <td bgcolor='$bgcolor' align='center' colspan='2'>Real</td>\n";
84 $bgcolor = ($bgcolor eq $bgcolor0) ? $bgcolor1 : $bgcolor0;
86 print "</tr>\n";
88 foreach $sitename (sort(keys(%::Sites))) {
89 print "<tr>\n";
91 my $site = $::Sites{$sitename};
92 print " <td>$sitename</td>\n";
94 $bgcolor = $bgcolor0;
95 foreach $category (@::Categories) {
96 my $count = $site->{$category}->{Count};
97 my $real = $site->{$category}->{Real};
98 my $cpu = $site->{$category}->{CPU};
99 my $real2 = $site->{$category}->{Real2};
100 my $cpu2 = $site->{$category}->{CPU2};
102 my $realdev = 0;
103 my $cpudev = 0;
105 if ($count) {
106 if ($count > 1) {
107 $realdev = sqrt( ( $real2 * $count - $real * $real ) / ( $count * ( $count - 1 ) ) );
108 $cpudev = sqrt( ( $cpu2 * $count - $cpu * $cpu ) / ( $count * ( $count - 1 ) ) );
111 $real /= $count;
112 $cpu /= $count;
114 else {
115 $count = 0;
116 $real = 0;
117 $cpu = 0;
120 printf " <td bgcolor='$bgcolor' align='right'>%0.2lf</td><td bgcolor='$bgcolor' align='left'>&plusmn;%0.2lf</td>\n", $cpu, $cpudev;
121 printf " <td bgcolor='$bgcolor' align='right'>%0.2lf</td><td bgcolor='$bgcolor' align='left'>&plusmn;%0.2lf</td>", $real, $realdev;
123 $bgcolor = ($bgcolor eq $bgcolor0) ? $bgcolor1 : $bgcolor0;
126 print "</tr>\n";
129 print "</table>\n";