Skip to content

Instantly share code, notes, and snippets.

@agentzh

agentzh/a.stp Secret

Created May 7, 2020 01:01
Show Gist options
  • Save agentzh/71336f0550bb2eca5786a4431bb2c340 to your computer and use it in GitHub Desktop.
Save agentzh/71336f0550bb2eca5786a4431bb2c340 to your computer and use it in GitHub Desktop.
global count = 0
global bts
global target_pids
probe begin {
warn("Start tracing")
}
probe process("/bin/sleep").begin {
target_pids[pid()] = 1;
}
probe process("/bin/sleep").end {
delete target_pids[pid()];
}
probe timer.profile {
if (!target_pids[pid()])
next;
bt = sprint_ubacktrace()
if (bt == "")
next;
bts[bt] <<< 1;
if (++count >= 1000) {
abort();
}
}
probe timer.s(3) {
abort()
}
probe end {
n = 0
foreach (bt in bts- limit 900) {
n += strlen(bt)
}
println("n = ", n)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment