Permalink
Browse files

update

  • Loading branch information...
1 parent 8b171a6 commit 9ca80f951d0fd281a2436aa18824de16874aa8ce Brendan Gregg committed Apr 16, 2012
Showing with 8 additions and 4 deletions.
  1. +8 −4 README
View
12 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

0 comments on commit 9ca80f9

Please sign in to comment.