From 2d45e339f3287cf0b4805ea91b3aa9f17b6d4752 Mon Sep 17 00:00:00 2001 From: Tim Moore Date: Wed, 15 Apr 2009 18:43:23 +0200 Subject: graphing widget and test harness --- testsuite/systemtap.examples/general/grapher.stp | 32 ++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 testsuite/systemtap.examples/general/grapher.stp (limited to 'testsuite/systemtap.examples/general') 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) +} -- cgit From 764b562f42c6ac7f02e0911cab47f87c827bf3bd Mon Sep 17 00:00:00 2001 From: Tim Moore Date: Mon, 20 Apr 2009 12:56:51 +0200 Subject: fix a bug with %% in format strings * translate.cxx (c_unparser::visit_print_format): Always use _stp_printf if a format string contains "%%". Previously a format string with no arguments would always be printed with _stp_print. * testsuite/systemtap.printf/basic6.stp: New test for %% in format strings. * testsuite/systemtap.printf/basic6.exp: test driver * testsuite/systemtap.examples/grapher.stp: Remove workaround for "%%" literal problem. --- testsuite/systemtap.examples/general/grapher.stp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'testsuite/systemtap.examples/general') diff --git a/testsuite/systemtap.examples/general/grapher.stp b/testsuite/systemtap.examples/general/grapher.stp index 04463979..4f326ec1 100644 --- a/testsuite/systemtap.examples/general/grapher.stp +++ b/testsuite/systemtap.examples/general/grapher.stp @@ -2,11 +2,11 @@ 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"); +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 -- cgit