diff options
author | David Smith <dsmith@redhat.com> | 2009-04-20 13:55:45 -0500 |
---|---|---|
committer | David Smith <dsmith@redhat.com> | 2009-04-20 13:55:45 -0500 |
commit | d1b6c2866b35575219fb36fa2307c9f87e876750 (patch) | |
tree | 4cc6d22bb879f302259074da840c279ee0b3c185 /testsuite/systemtap.examples/general/grapher.stp | |
parent | cfee927fb9fc96fa06c55219abce6349a15d47e6 (diff) | |
parent | 555b11c26094bafa5e450d8ad70b72a8fcbea10f (diff) | |
download | systemtap-steved-d1b6c2866b35575219fb36fa2307c9f87e876750.tar.gz systemtap-steved-d1b6c2866b35575219fb36fa2307c9f87e876750.tar.xz systemtap-steved-d1b6c2866b35575219fb36fa2307c9f87e876750.zip |
Merge branch 'master' of ssh://sources.redhat.com/git/systemtap
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..4f326ec1 --- /dev/null +++ b/testsuite/systemtap.examples/general/grapher.stp @@ -0,0 +1,32 @@ +#! /usr/bin/stap + +probe begin +{ +printf ("%%Title:CPU utilization\n"); +printf ("%%XAxisTitle:Time"); +printf ("%%YAxisTitle:Percent"); +printf ("%%DataSet:cpu 100 00ff00 bar"); +printf ("%%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) +} |