Admin/profiling_report
author wenzelm
Tue, 25 Mar 2014 16:54:38 +0100
changeset 56279 b4d874f6c6be
parent 36859 51af1657263b
permissions -rwxr-xr-x
clarified options ML_source_trace and ML_exception_trace (NB: the latter needs to be a system option, since the context is sometimes not available, e.g. for 'theory' command);

#!/usr/bin/env perl
#
# Author: Makarius
#
# DESCRIPTION: Simple report generator for Poly/ML profiling output.

use strict;

my %log = ();
my @output = ();

while (<ARGV>) {
    if (m,^([ 0-9]{10}) (\S+$|GARBAGE COLLECTION.*$),) {
	my $count = $1;
	my $fun = $2;
	$fun =~ s,-?\(\d+\).*$,,g;
	$fun =~ s,/\d+$,,g;
	if ($count =~ m,^\s*(\d)+$,) {
	    if (defined($log{$fun})) {
		$log{$fun} += $count;
	    } else {
		$log{$fun} = $count;
	    }
	}
    }
}

foreach my $fun (keys %log) {
    push @output, (sprintf "%14u %s\n", $log{$fun}, $fun);
}

print (sort @output);