README.md edited online with Bitbucket
[swg-src.git] / tools / reports / analyzeProfile.pl
bloba84547b8ff3dac643403384c673de0997932ad56
1 my $profileText;
2 my %profileNames;
3 my $profileTag;
5 while(<STDIN>)
7 if(! ($_ =~ /rofile/))
9 if($_ =~ /\s*(\w*)\s*(\w*)\%\s*(\w*)\s*(-)\s*(.*)/)
11 $profileTag .= "$5\n";
12 $profileText .= $_;
13 $entry = "$1,$2,$3,$5";
15 if(! exists($profileNames{$5}))
17 $profileNames{$5} = $entry;
19 else
21 @items = split(',', $profileNames{$5});
22 $totalTime = $items[0] + $1;
23 $callCount = $items[2] + $3;
24 $newEntry = "$totalTime, $items[1], $callCount, $5";
30 print "\"Description\", \"Total Time\", \"Call Count\", \"Call Cost\"\n";
31 foreach my $key(keys(%profileNames))
33 @items = split(',', $profileNames{$key});
34 $callCost = `echo \"$items[0] / $items[2]\" | bc -l`;
35 chomp($callCost);
37 print "$key, $items[0], $items[2], $callCost\n";