commit 9ca80f951d0fd281a2436aa18824de16874aa8ce
parent 8b171a6265c7424aed7425d3b0921dd2af6c5f70
Author: Brendan Gregg <brendan.gregg@joyent.com>
Date: Mon, 16 Apr 2012 16:21:38 -0700
update
Diffstat:
1 file changed, 8 insertions(+), 4 deletions(-)
diff --git a/README b/README
@@ -1,6 +1,7 @@
Flame Graphs visualize hot-CPU code-paths.
-See: http://dtrace.org/blogs/brendan/2011/12/16/flame-graphs/
+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/
These can be created in three steps:
@@ -17,12 +18,15 @@ Using DTrace to capture 60 seconds of kernel stacks at 997 Hertz:
# dtrace -x stackframes=100 -n 'profile-997 /arg0/ { @[stack()] = count(); } tick-60s { exit(0); }' -o out.kern_stacks
-Using DTrace to capture 60 seconds of user-level stacks for PID 12345 at 997 Hertz:
+Using DTrace to capture 60 seconds of user-level stacks for PID 12345 at 97 Hertz:
-# dtrace -x ustackframes=100 -n 'profile-997 /PID == 12345/ { @[ustack()] = count(); } tick-60s { exit(0); }' -o out.user_stacks
+# dtrace -x ustackframes=100 -n 'profile-97 /PID == 12345 && arg1/ { @[ustack()] = count(); } tick-60s { exit(0); }' -o out.user_stacks
-You can include "arg1" in the predicate if you just want to study user-level CPU time only; otherwise it includes kernel time in the user-level flame graph (eg, syscall time). (Make sure you understand what that means!)
+Using DTrace to capture 60 seconds of user-level stacks, including while time is spent in the kernel, for PID 12345 at 97 Hertz:
+# dtrace -x ustackframes=100 -n 'profile-97 /PID == 12345/ { @[ustack()] = count(); } tick-60s { exit(0); }' -o out.user_stacks
+
+Switch ustack() for jstack() if the application has a ustack helper to include translated frames (eg, node.js frames; see: http://dtrace.org/blogs/dap/2012/01/05/where-does-your-node-program-spend-its-time/). The rate for user-level stack collection is deliberately slower than kernel, which is especially important when using jstack() as it performs additional work to translate frames.
2. Fold stacks