Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
branch: master
Fetching contributors…

Cannot retrieve contributors at this time

executable file 27 lines (23 sloc) 0.504 kb
#!/usr/bin/perl -w
#
# stackcollapse-instruments.pl
#
# Parses a CSV file containing a call tree as produced by XCode
# Instruments and produces output suitable for flamegraph.pl.
#
# USAGE: ./stackcollapse-instruments.pl infile > outfile
use strict;
my @stack = ();
<>;
foreach (<>) {
chomp;
/(\d+)\.\d+ms[^,]+,\d+,\s+,(\s*)(.+)/ or die;
my $func = $3;
my $depth = length ($2);
$stack [$depth] = $3;
foreach my $i (0 .. $depth - 1) {
print $stack [$i];
print ";";
}
print "$func $1\n";
}
Jump to Line
Something went wrong with that request. Please try again.