Output stack+heap usage with massif

This commit is contained in:
Manuel Pégourié-Gonnard 2014-12-01 14:05:45 +01:00
parent 0de7f94773
commit c6dbc8eb84

View File

@ -15,7 +15,7 @@ open my $fh, '<', $ARGV[0] or die;
{ local $/ = 'snapshot='; @snaps = <$fh>; } { local $/ = 'snapshot='; @snaps = <$fh>; }
close $fh or die; close $fh or die;
my $max = 0; my ($max, $max_heap, $max_he, $max_stack) = (0, 0, 0, 0);
for (@snaps) for (@snaps)
{ {
my ($heap, $heap_extra, $stack) = m{ my ($heap, $heap_extra, $stack) = m{
@ -25,7 +25,9 @@ for (@snaps)
}xm; }xm;
next unless defined $heap; next unless defined $heap;
my $total = $heap + $heap_extra + $stack; my $total = $heap + $heap_extra + $stack;
$max = $total if $total > $max; if( $total > $max ) {
($max, $max_heap, $max_he, $max_stack) = ($total, $heap, $heap_extra, $stack);
}
} }
printf "$max\n"; printf "$max (heap $max_heap+$max_he, stack $max_stack)\n";