diff options
Diffstat (limited to 'testsuite/systemtap.samples/kmalloc-stacks.stp')
-rw-r--r-- | testsuite/systemtap.samples/kmalloc-stacks.stp | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/testsuite/systemtap.samples/kmalloc-stacks.stp b/testsuite/systemtap.samples/kmalloc-stacks.stp new file mode 100644 index 00000000..25a23f2d --- /dev/null +++ b/testsuite/systemtap.samples/kmalloc-stacks.stp @@ -0,0 +1,35 @@ +global kmalloc_stack + +function reset_maxaction () %{ + if (CONTEXT && CONTEXT->actioncount) + CONTEXT->actioncount=0; +%} + +function write_output() +{ + foreach (stack in kmalloc_stack) { + log("<hashkey>"); + print_stack(stack); + log("</hashkey>"); + print("<hashval>"); + print(sprint(kmalloc_stack[stack])); + log("</hashval>"); + reset_maxaction(); + } +} + +probe timer.jiffies(5000) +{ + write_output(); + delete kmalloc_stack; +} + +probe kernel.function("__kmalloc") +{ + kmalloc_stack[backtrace()]++; +} + +probe end +{ + write_output(); +} |