This is the mail archive of the systemtap@sourceware.org mailing list for the systemtap project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH 2/2] 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 missing copyright header that was missing in
ansi_colors.stp for a long time.
---
 .../systemtap.examples/general/ansi_colors.stp     |   43 ++++++++++++--------
 testsuite/systemtap.examples/io/ioblktime.stp      |    2 +-
 testsuite/systemtap.examples/profiling/timeout.stp |    2 +-
 3 files changed, 28 insertions(+), 19 deletions(-)

diff --git a/testsuite/systemtap.examples/general/ansi_colors.stp b/testsuite/systemtap.examples/general/ansi_colors.stp
index ae954e6..64358e2 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 <eteo@redhat.com>
+#
+# 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);
+	new_line()
+	for (l = 0; l < 71; l++)
+		printf("-");
+	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++) {
+				set_color3(r, c, t)
+				printf(" %s ", !t ? "Normal" : "Bold  ")
+				reset_color()
+			}
+			new_line()
+		}
+	exit();
 }
diff --git a/testsuite/systemtap.examples/io/ioblktime.stp b/testsuite/systemtap.examples/io/ioblktime.stp
index 5ff59cf..b9771e4 100755
--- a/testsuite/systemtap.examples/io/ioblktime.stp
+++ b/testsuite/systemtap.examples/io/ioblktime.stp
@@ -18,7 +18,7 @@ probe ioblock.end
 }
 
 probe timer.s(10), end {
-  printf("\033[2J\033[1;1H") /* clear screen */
+  clear_screen()
   printf("%10s %3s %10s %10s %10s\n",
          "device", "rw", "total (us)", "count", "avg (us)")
   foreach ([dev,rw] in etimes - limit 20) {
diff --git a/testsuite/systemtap.examples/profiling/timeout.stp b/testsuite/systemtap.examples/profiling/timeout.stp
index 48d6d21..6c2ab64 100755
--- a/testsuite/systemtap.examples/profiling/timeout.stp
+++ b/testsuite/systemtap.examples/profiling/timeout.stp
@@ -90,7 +90,7 @@ probe syscall.exit {
 }
 
 probe timer.s(1) {
-  printf("\033[2J\033[1;1H") /* clear screen */
+  clear_screen()
   printf ("  uid |   poll  select   epoll  itimer   futex nanosle  signal| process\n")
   foreach (p in timeout_count- limit 20) {
      printf ("%5d |%7d %7d %7d %7d %7d %7d %7d| %-.38s\n", p,
-- 
1.6.0.6


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]