Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Stack folder for XCode Instruments.

  • Loading branch information...
commit 8297f83c31a2d4696b0865dd178f8716dddf62f0 1 parent 9890030
@schani schani authored
Showing with 28 additions and 0 deletions.
  1. +2 −0  README
  2. +26 −0 stackcollapse-instruments.pl
View
2  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:
View
26 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";
+}
Please sign in to comment.
Something went wrong with that request. Please try again.