commit d9407a85935346b3ea8e0815e1856dfc861d8fce
parent 98900303a96e232c8103fb399f6f5ce497f995a1
Author: Brendan Gregg <brendan.d.gregg@gmail.com>
Date: Fri, 16 Nov 2012 15:26:10 -0800
Merge pull request #6 from schani/master
Stack folder for XCode Instruments
Diffstat:
2 files changed, 28 insertions(+), 0 deletions(-)
diff --git a/README b/README
@@ -2,6 +2,7 @@ Flame Graphs visualize hot-CPU code-paths.
Using DTrace, see: http://dtrace.org/blogs/brendan/2011/12/16/flame-graphs/
Using perf_events or SystemTap, see: http://dtrace.org/blogs/brendan/2012/03/17/linux-kernel-performance-flame-graphs/
+Using XCode Instruments, see: http://schani.wordpress.com/2012/11/16/flame-graphs-for-instruments/
These can be created in three steps:
@@ -35,6 +36,7 @@ Use the stackcollapse programs to fold stack samples into single lines. The pro
- stackcollapse.pl: for DTrace stacks
- stackcollapse-perf.pl: for perf_events "perf script" output
- stackcollapse-stap.pl: for SystemTap stacks
+- stackcollapse-instruments.pl: for XCode Instruments
Usage example:
diff --git a/stackcollapse-instruments.pl b/stackcollapse-instruments.pl
@@ -0,0 +1,26 @@
+#!/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";
+}