From 5ddc5963ce06ecea574e90ca503a3ee598522d8f Mon Sep 17 00:00:00 2001 From: Tim Moore Date: Fri, 4 Dec 2009 13:08:01 +0100 Subject: support multiline data output from scripts run under the grapher This is accompanied by support for multiline output in hover text. * grapher/StapParser.cxx (ioCallback): Read data 'til the end of line character, not just '\n'. Be careful to use I/O functions that don't treat '\n' specially. * grapher/StapParser.hxx: ditto * grapher/CairoWidget.cxx (CairoTextBox::draw): Perform line breaks for hover text. * testsuite/systemtap.examples/general/grapher.stp: Do multiline output of keyboard events. Also, fix longstanding breaking in the pty probe. --- testsuite/systemtap.examples/general/grapher.stp | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) (limited to 'testsuite/systemtap.examples') diff --git a/testsuite/systemtap.examples/general/grapher.stp b/testsuite/systemtap.examples/general/grapher.stp index e8655b37..c1c60437 100755 --- a/testsuite/systemtap.examples/general/grapher.stp +++ b/testsuite/systemtap.examples/general/grapher.stp @@ -8,7 +8,7 @@ printf ("%%DataSet:pty 50 0000ff discreet\n"); printf ("cpu %%Title:CPU utilization\n"); printf ("cpu %%XAxisTitle:Time\n"); printf ("cpu %%YAxisTitle:Percent\n"); - +printf ("%%LineEnd:0\n"); } # CPU utilization @@ -26,17 +26,25 @@ function qsq_util_reset(q) { probe timer.ms(100) { # collect utilization percentages frequently foreach (q in qnames) - printf("cpu %d %d\n", gettimeofday_ms(), qsq_util_reset(q)) + printf("cpu %d %d%c", gettimeofday_ms(), qsq_util_reset(q), 0) } probe kernel.function("kbd_event") { if ($event_type == 1 && $value) - printf("kbd %d %d\n", gettimeofday_ms(), $event_code) + printf("kbd %d %d\n0x%x%c", gettimeofday_ms(), $event_code, $event_code, 0) } probe kernel.function("pty_write") { - if (count > 0) - printf("pty %d %.5s\n", gettimeofday_ms(), buf) + if ($count > 0) { + printf("pty %d ", gettimeofday_ms()) + str = kernel_string($buf) + for (i = 0; i < $count; ++i) { + # yes it's gross + c = substr(str, i, 1) + printf("%s\n", text_str(c)) + } + printf("%c", 0) + } } -- cgit