From 384c5fe974abe35ab11dce4446dc5eed86585a3b Mon Sep 17 00:00:00 2001 From: "Frank Ch. Eigler" Date: Thu, 7 Aug 2008 16:47:18 -0400 Subject: samples: separate into subdirectories by subsystem --- testsuite/systemtap.examples/general/graphs.stp | 60 +++++++++++++++++++++++++ 1 file changed, 60 insertions(+) create mode 100644 testsuite/systemtap.examples/general/graphs.stp (limited to 'testsuite/systemtap.examples/general/graphs.stp') diff --git a/testsuite/systemtap.examples/general/graphs.stp b/testsuite/systemtap.examples/general/graphs.stp new file mode 100644 index 00000000..0c8e3796 --- /dev/null +++ b/testsuite/systemtap.examples/general/graphs.stp @@ -0,0 +1,60 @@ +#! stap + +# ------------------------------------------------------------------------ +# data collection + +# disk I/O stats +probe begin { qnames["ioblock"] ++; qsq_start ("ioblock") } +probe ioblock.request { qs_wait ("ioblock") qs_run("ioblock") } +probe ioblock.end { qs_done ("ioblock") } + +# 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") } + + +# ------------------------------------------------------------------------ +# utilization history tracking + +global N +probe begin { N = 50 } + +global qnames, util, histidx + +function qsq_util_reset(q) { + u=qsq_utilization (q, 100) + qsq_start (q) + return u +} + +probe timer.ms(100) { # collect utilization percentages frequently + histidx = (histidx + 1) % N # into circular buffer + foreach (q in qnames) + util[histidx,q] = qsq_util_reset(q) +} + + +# ------------------------------------------------------------------------ +# general gnuplot graphical report generation + +probe timer.ms(1000) { + # emit gnuplot command to display recent history + + printf ("set yrange [0:100]\n") + printf ("plot ") + foreach (q in qnames+) + { + if (++nq >= 2) printf (", ") + printf ("'-' title \"%s\" with lines", q) + } + printf ("\n") + + foreach (q in qnames+) { + for (i = (histidx + 1) % N; i != histidx; i = (i + 1) % N) + printf("%d\n", util[i,q]) + printf ("e\n") + } + + printf ("pause 1\n") +} -- cgit From a81c61ac1947cb5c13d3a758fc793a119b88b4e0 Mon Sep 17 00:00:00 2001 From: Mark Wielaard Date: Mon, 11 Aug 2008 12:24:47 +0200 Subject: PR2895. Add proper #! /usr/bin/env stap line. Make example scripts executable. --- testsuite/systemtap.examples/general/graphs.stp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) mode change 100644 => 100755 testsuite/systemtap.examples/general/graphs.stp (limited to 'testsuite/systemtap.examples/general/graphs.stp') diff --git a/testsuite/systemtap.examples/general/graphs.stp b/testsuite/systemtap.examples/general/graphs.stp old mode 100644 new mode 100755 index 0c8e3796..f55d6cee --- a/testsuite/systemtap.examples/general/graphs.stp +++ b/testsuite/systemtap.examples/general/graphs.stp @@ -1,4 +1,4 @@ -#! stap +#! /usr/bin/stap # ------------------------------------------------------------------------ # data collection -- cgit