Skip to content

Instantly share code, notes, and snippets.

@jribeiro
Forked from bnoordhuis/gc.stp
Last active August 29, 2015 14:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jribeiro/7f69011377e76d8f96ef to your computer and use it in GitHub Desktop.
Save jribeiro/7f69011377e76d8f96ef to your computer and use it in GitHub Desktop.
#!/usr/bin/env stap
global samples
global all_samples
global timestamp
probe process("node").mark("gc__start")
{
timestamp = gettimeofday_us()
}
probe process("node").mark("gc__done")
{
sample = gettimeofday_us() - timestamp
samples <<< sample
all_samples <<< sample
}
probe timer.s(5)
{
print(@hist_log(samples))
printf("min:%d avg:%d max:%d count:%d\n",
@min(samples), @avg(samples),
@max(samples), @count(samples))
delete samples
}
probe end
{
print(@hist_log(all_samples))
printf("min:%d avg:%d max:%d count:%d\n",
@min(all_samples), @avg(all_samples),
@max(all_samples), @count(all_samples))
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment