From 8e6c3aa3d61109b0276e96cdbc9ffdde60a5ac0a Mon Sep 17 00:00:00 2001 From: Eugene Teo Date: Fri, 3 Apr 2009 23:46:43 +0800 Subject: New ANSI escape sequences tapset This adds a new tapset for ANSI escape sequences. It is based on an existing tapset that was written by Masami Hiramatsu for the stapgames project. This also adds a version of ansi_color.stp script that displays other attributes other than the bold effect. --- .../systemtap.examples/general/ansi_colors2.stp | 31 ++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 testsuite/systemtap.examples/general/ansi_colors2.stp (limited to 'testsuite/systemtap.examples/general') diff --git a/testsuite/systemtap.examples/general/ansi_colors2.stp b/testsuite/systemtap.examples/general/ansi_colors2.stp new file mode 100644 index 00000000..5f1b102e --- /dev/null +++ b/testsuite/systemtap.examples/general/ansi_colors2.stp @@ -0,0 +1,31 @@ +#!/usr/bin/env stap +# ansi_colors2.stp +# Copyright (C) 2009 Red Hat, Inc., Eugene Teo +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License version 2 as +# published by the Free Software Foundation. +# + +probe begin { + printf("a \\ b |"); + for (c = 40; c < 48; c++) + printf(" %d ", c); + ansi_new_line() + for (l = 0; l < 71; l++) + printf("-"); + ansi_new_line() + + for (r = 30; r < 38; r++) + # this displays more attributes + for (t = 0; t < 8; !t ? ++t : t+=3) { + printf("%d |", r); + for (c = 40; c < 48; c++) { + ansi_set_color3(r, c, t) + printf(" Colors ") + ansi_reset_color() + } + ansi_new_line() + } + exit(); +} -- cgit From a8e88602f1c7cbe302542d5af427d354d7d457ba Mon Sep 17 00:00:00 2001 From: Eugene Teo Date: Fri, 3 Apr 2009 23:54:23 +0800 Subject: Update scripts to use the new ANSI tapset This updates the example scripts to use the new ANSI escape sequences tapset. It also adds the copyright header that was missing in ansi_colors.stp for a long time. --- .../systemtap.examples/general/ansi_colors.stp | 43 +++++++++++++--------- 1 file changed, 26 insertions(+), 17 deletions(-) (limited to 'testsuite/systemtap.examples/general') diff --git a/testsuite/systemtap.examples/general/ansi_colors.stp b/testsuite/systemtap.examples/general/ansi_colors.stp index ae954e69..02c7c847 100755 --- a/testsuite/systemtap.examples/general/ansi_colors.stp +++ b/testsuite/systemtap.examples/general/ansi_colors.stp @@ -1,21 +1,30 @@ -#! /usr/bin/env stap +#!/usr/bin/env stap +# ansi_colors.stp +# Copyright (C) 2006-2009 Red Hat, Inc., Eugene Teo +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License version 2 as +# published by the Free Software Foundation. +# probe begin { - printf("a \\ b |"); - for (c = 40; c < 48; c++) - printf(" %d ", c); - printf("\12"); - for (l = 0; l < 71; l++) - printf("-"); - printf("\12"); + printf("a \\ b |"); + for (c = 40; c < 48; c++) + printf(" %d ", c); + ansi_new_line() + for (l = 0; l < 71; l++) + printf("-"); + ansi_new_line() - for (r = 30; r < 38; r++) - for (t = 0; t < 2; t++) { - printf("%d |", r); - for (c = 40; c < 48; c++) - printf("\033[%d;%d%s %s \033[0;0m", - r, c, !t ? "m" : ";1m", !t ? "Normal" : "Bold "); - printf("\12"); - } - exit(); + for (r = 30; r < 38; r++) + for (t = 0; t < 2; t++) { + printf("%d |", r); + for (c = 40; c < 48; c++) { + ansi_set_color3(r, c, t) + printf(" %s ", !t ? "Normal" : "Bold ") + ansi_reset_color() + } + ansi_new_line() + } + exit(); } -- cgit From d1ec6e13b6f971ea23fb3203460384836c04b3c0 Mon Sep 17 00:00:00 2001 From: Eugene Teo Date: Fri, 3 Apr 2009 23:56:19 +0800 Subject: Make ansi_colors2.stp script executable --- testsuite/systemtap.examples/general/ansi_colors2.stp | 0 1 file changed, 0 insertions(+), 0 deletions(-) mode change 100644 => 100755 testsuite/systemtap.examples/general/ansi_colors2.stp (limited to 'testsuite/systemtap.examples/general') diff --git a/testsuite/systemtap.examples/general/ansi_colors2.stp b/testsuite/systemtap.examples/general/ansi_colors2.stp old mode 100644 new mode 100755 -- cgit From 0e0b566a5c6de7e824067963f3c516d09d9962d3 Mon Sep 17 00:00:00 2001 From: William Cohen Date: Fri, 3 Apr 2009 14:38:19 -0400 Subject: Describe the ansi_colors.stp and ansi_colors2.stp. Label tables appropriately. --- testsuite/systemtap.examples/general/ansi_colors.meta | 13 +++++++++++++ testsuite/systemtap.examples/general/ansi_colors.stp | 6 +++--- testsuite/systemtap.examples/general/ansi_colors2.meta | 13 +++++++++++++ testsuite/systemtap.examples/general/ansi_colors2.stp | 6 +++--- 4 files changed, 32 insertions(+), 6 deletions(-) create mode 100644 testsuite/systemtap.examples/general/ansi_colors.meta create mode 100644 testsuite/systemtap.examples/general/ansi_colors2.meta (limited to 'testsuite/systemtap.examples/general') diff --git a/testsuite/systemtap.examples/general/ansi_colors.meta b/testsuite/systemtap.examples/general/ansi_colors.meta new file mode 100644 index 00000000..2818c235 --- /dev/null +++ b/testsuite/systemtap.examples/general/ansi_colors.meta @@ -0,0 +1,13 @@ +title: Color Table for ansi_set_color2() and ansi_set_color3() +name: ansi_colors.stp +version: 1.0 +author: Eugene Teo +keywords: format +subsystem: none +status: production +exit: fixed +output: text +scope: system-wide +description: The script prints a table showing the available color combinations for the ansi_set_color2() and ans_set_color3() functions in the ansi.stp tapset. +test_check: stap -p4 ansi_colors.stp +test_installcheck: stap ansi_colors.stp diff --git a/testsuite/systemtap.examples/general/ansi_colors.stp b/testsuite/systemtap.examples/general/ansi_colors.stp index 02c7c847..01e58b9c 100755 --- a/testsuite/systemtap.examples/general/ansi_colors.stp +++ b/testsuite/systemtap.examples/general/ansi_colors.stp @@ -8,17 +8,17 @@ # probe begin { - printf("a \\ b |"); + printf("fg,t \\ bg |"); for (c = 40; c < 48; c++) printf(" %d ", c); ansi_new_line() - for (l = 0; l < 71; l++) + for (l = 0; l < 75; l++) printf("-"); ansi_new_line() for (r = 30; r < 38; r++) for (t = 0; t < 2; t++) { - printf("%d |", r); + printf(" %2d,%1d |", r, t); for (c = 40; c < 48; c++) { ansi_set_color3(r, c, t) printf(" %s ", !t ? "Normal" : "Bold ") diff --git a/testsuite/systemtap.examples/general/ansi_colors2.meta b/testsuite/systemtap.examples/general/ansi_colors2.meta new file mode 100644 index 00000000..4ccaf4e3 --- /dev/null +++ b/testsuite/systemtap.examples/general/ansi_colors2.meta @@ -0,0 +1,13 @@ +title: Show Attribues in Table for ansi_set_color3() +name: ansi_colors2.stp +version: 1.0 +author: Eugene Teo +keywords: format +subsystem: none +status: production +exit: fixed +output: text +scope: system-wide +description: The script prints a table showing the available attributes (bold, underline, and inverse) with color combinations for the ans_set_color3() function in the ansi.stp tapset. +test_check: stap -p4 ansi_colors2.stp +test_installcheck: stap ansi_colors2.stp diff --git a/testsuite/systemtap.examples/general/ansi_colors2.stp b/testsuite/systemtap.examples/general/ansi_colors2.stp index 5f1b102e..fadcf011 100755 --- a/testsuite/systemtap.examples/general/ansi_colors2.stp +++ b/testsuite/systemtap.examples/general/ansi_colors2.stp @@ -8,18 +8,18 @@ # probe begin { - printf("a \\ b |"); + printf("fg,t \\ bg |"); for (c = 40; c < 48; c++) printf(" %d ", c); ansi_new_line() - for (l = 0; l < 71; l++) + for (l = 0; l < 75; l++) printf("-"); ansi_new_line() for (r = 30; r < 38; r++) # this displays more attributes for (t = 0; t < 8; !t ? ++t : t+=3) { - printf("%d |", r); + printf(" %2d,%1d |", r, t); for (c = 40; c < 48; c++) { ansi_set_color3(r, c, t) printf(" Colors ") -- cgit 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 From ea7d087ab3866eb99c19444b237c9586e8dc9b17 Mon Sep 17 00:00:00 2001 From: Ananth N Mavinakayanahalli Date: Thu, 30 Apr 2009 17:00:38 +0530 Subject: PR10007: Avoid probing syscall entry points in the testsuite. While there, fix minor issues with the s390x syscall tapset. --- testsuite/systemtap.examples/general/para-callgraph.meta | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'testsuite/systemtap.examples/general') diff --git a/testsuite/systemtap.examples/general/para-callgraph.meta b/testsuite/systemtap.examples/general/para-callgraph.meta index 87af07cf..84d1c93f 100644 --- a/testsuite/systemtap.examples/general/para-callgraph.meta +++ b/testsuite/systemtap.examples/general/para-callgraph.meta @@ -3,5 +3,5 @@ name: para-callgraph.stp keywords: trace callgraph subsystem: general description: Print a timed per-thread callgraph, complete with function parameters and return values. The first parameter names the function probe points to trace. The optional second parameter names the probe points for trigger functions, which acts to enable tracing for only those functions that occur while the current thread is nested within the trigger. -test_check: stap -p4 para-callgraph.stp kernel.function("*@fs/proc*.c") kernel.function("sys_read") -test_installcheck: stap para-callgraph.stp kernel.function("*@fs/proc*.c") kernel.function("sys_read") -c "cat /proc/sys/vm/*" +test_check: stap -p4 para-callgraph.stp kernel.function("*@fs/proc*.c") kernel.function("vfs_read") +test_installcheck: stap para-callgraph.stp kernel.function("*@fs/proc*.c") kernel.function("vfs_read") -c "cat /proc/sys/vm/*" -- cgit