Skip to content

Instantly share code, notes, and snippets.

@nicwolff
Last active August 29, 2015 13:57
Show Gist options
  • Select an option

  • Save nicwolff/9609179 to your computer and use it in GitHub Desktop.

Select an option

Save nicwolff/9609179 to your computer and use it in GitHub Desktop.
Filter to show time spent in subcomponents in Mason profile log
#!/usr/bin/perl -nl
next unless ($p) = /(\d+)-\d+$/;
s/\\n.*//;
s/.*\ - //;
s/{{{/{/ and $t{$p}{++$d{$p}} = 0;
s/}}}/}/ and --$d{$p} and /(\d+\.\d+)/ and $t{$p}{$d{$p}} += $1 and $a = $t{$p}{$d{$p}+1} and $r = round($1-$a) and s{$}{ / $r};
print;
sub round { int($_[0]*10000+.5)/10000 }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment