Created
January 22, 2019 21:29
-
-
Save misha354/31b2eb3f83803a163b3e6b6ce72df1c9 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Based on Brendan Gregg's work: http://www.brendangregg.com/FlameGraphs/cpuflamegraphs.html | |
*/ | |
global s; | |
global quit = 0; | |
probe timer.profile { | |
if (pid() == target()) { | |
if (quit) { | |
foreach (i in s-) { | |
print_stack(i); | |
printf("\t%d\n", @count(s[i])); | |
} | |
exit() | |
} else { | |
s[ubacktrace()] <<< 1; | |
} | |
} | |
} | |
probe timer.s(20) { | |
quit = 1 | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment