diff options
author | Tim Moore <timoore@redhat.com> | 2009-04-20 10:06:50 +0200 |
---|---|---|
committer | Tim Moore <timoore@redhat.com> | 2009-04-20 10:06:50 +0200 |
commit | c6cc0049534b543878844c728dbdd3a06cbf7969 (patch) | |
tree | 75df1566da2f5f780249e1e8c3a25b41fc85610b /testsuite/systemtap.examples/general/grapher.stp | |
parent | b185f07818262bad07e2904a696f2dfcd22fc1fe (diff) | |
parent | 1087b83f9b60e85d3d41cebd797f2eb4cc495bc6 (diff) | |
download | systemtap-steved-c6cc0049534b543878844c728dbdd3a06cbf7969.tar.gz systemtap-steved-c6cc0049534b543878844c728dbdd3a06cbf7969.tar.xz systemtap-steved-c6cc0049534b543878844c728dbdd3a06cbf7969.zip |
Merge branch 'timoore/grapher'
Diffstat (limited to 'testsuite/systemtap.examples/general/grapher.stp')
-rw-r--r-- | testsuite/systemtap.examples/general/grapher.stp | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/testsuite/systemtap.examples/general/grapher.stp b/testsuite/systemtap.examples/general/grapher.stp new file mode 100644 index 00000000..04463979 --- /dev/null +++ b/testsuite/systemtap.examples/general/grapher.stp @@ -0,0 +1,32 @@ +#! /usr/bin/stap + +probe begin +{ +printf ("%s\n", "%Title:CPU utilization"); +printf ("%s\n", "%XAxisTitle:Time"); +printf ("%s\n", "%YAxisTitle:Percent"); +printf ("%s\n", "%DataSet:cpu 100 00ff00 bar"); +printf ("%s\n", "%DataSet:kbd 100 ff0000 dot"); +} + +# CPU utilization +probe begin { qnames["cpu"] ++; qsq_start ("cpu") } +probe scheduler.cpu_on { if (!idle) {qs_wait ("cpu") qs_run ("cpu") }} +probe scheduler.cpu_off { if (!idle) qs_done ("cpu") } + +global qnames + +function qsq_util_reset(q) { + u=qsq_utilization (q, 100) + qsq_start (q) + return u +} + +probe timer.ms(100) { # collect utilization percentages frequently + foreach (q in qnames) + printf("cpu %d %d\n", gettimeofday_ms(), qsq_util_reset(q)) +} + +probe kernel.function("kbd_event") { + printf("kbd %d %d\n", gettimeofday_ms(), 75) +} |