#!/usr/bin/perl # This Source Code Form is subject to the terms of the Mozilla Public # License, v. 2.0. If a copy of the MPL was not distributed with this # file, You can obtain one at http://mozilla.org/MPL/2.0/. $argv = $ARGV[0]; open( bloatFile, $argv ) or die "Can't open $argv: $!\n"; while () { if (/name=/) { ($td,$name,$func,$a,$ntd) = split(/>/, $_); ($fname, $memSize) = split( / /, $func ); ($trash, $linkName) = split( /"/, $name ); $namesLinks{$fname} = $linkName; if ($namesSizes{$fname}) { $namesSizes{$fname} = $namesSizes{$fname} + $memSize; } else { $namesSizes{$fname} = $memSize; } } } $argv = $ARGV[1]; if ($argv) { open( bloatFile, $argv ) or die "Can't open $argv: $!\n"; while () { if (/name=/) { ($td,$name,$func,$a,$ntd) = split(/>/, $_); ($fname, $memSize) = split( / /, $func ); $namesSizes{$fname} = $namesSizes{$fname} - $memSize; } } } sub byvalue { $namesSizes{$b} <=> $namesSizes{$a} } print ''; print "\n\n"; print "Bloat Blame Delta\n"; print ''; print "\n\n\n\n"; print "\n"; foreach $key (sort byvalue keys %namesSizes) { if ($namesSizes{$key}) { print "\n"; print ' \n"; print " \n"; print "\n" } } print "
Memory AllocatedFunction NameLink
', $namesSizes{$key}," ", $key, "
\n";