blob: df30f0f8ee381bffe086bedbf3930167bb79639f [file] [log] [blame]
Manuel Pégourié-Gonnard4d5cc112014-11-25 12:21:48 +01001#!/usr/bin/perl
2
3# Parse a massif.out.xxx file and output peak total memory usage
4
5use warnings;
6use strict;
7
8use utf8;
9use open qw(:std utf8);
10
11die unless @ARGV == 1;
12
13my @snaps;
14open my $fh, '<', $ARGV[0] or die;
15{ local $/ = 'snapshot='; @snaps = <$fh>; }
16close $fh or die;
17
18my $max = 0;
19for (@snaps)
20{
21 my ($heap, $heap_extra, $stack) = m{
22 mem_heap_B=(\d+)\n
23 mem_heap_extra_B=(\d+)\n
24 mem_stacks_B=(\d+)
25 }xm;
26 next unless defined $heap;
27 my $total = $heap + $heap_extra + $stack;
28 $max = $total if $total > $max;
29}
30
31printf "$max\n";