From 67f8611b9ed9e40a7be946601293ac5b42c52686 Mon Sep 17 00:00:00 2001 From: William Cohen Date: Tue, 17 Mar 2009 16:45:30 -0400 Subject: Replace systemtap.samples/ioblocktest.stp with ioblktime.stp. --- testsuite/systemtap.examples/io/ioblktime.meta | 13 ++++++++++++ testsuite/systemtap.examples/io/ioblktime.stp | 29 ++++++++++++++++++++++++++ 2 files changed, 42 insertions(+) create mode 100644 testsuite/systemtap.examples/io/ioblktime.meta create mode 100755 testsuite/systemtap.examples/io/ioblktime.stp (limited to 'testsuite/systemtap.examples/io') diff --git a/testsuite/systemtap.examples/io/ioblktime.meta b/testsuite/systemtap.examples/io/ioblktime.meta new file mode 100644 index 00000000..18a8b168 --- /dev/null +++ b/testsuite/systemtap.examples/io/ioblktime.meta @@ -0,0 +1,13 @@ +title: Average Time Block IO Requests Spend in Queue +name: ioblktime.stp +version: 1.0 +author: William Cohen +keywords: io +subsystem: kernel +status: production +exit: user-controlled +output: sorted-list +scope: system-wide +description: The ioblktime.stp script tracks the amount of time that each block IO requests spend waiting for completion. The script computes the average time waiting time for block IO per device and prints list every 10 seconds. In some cases there can be too many oustanding block IO operations and the script may exceed the default number of MAXMAPENTRIES allowed. In this case the allowed number can be increased with "-DMAXMAPENTRIES=10000" option on the stap command line. +test_check: stap -p4 ioblktime.stp +test_installcheck: stap ioblktime.stp -c "sleep 1" diff --git a/testsuite/systemtap.examples/io/ioblktime.stp b/testsuite/systemtap.examples/io/ioblktime.stp new file mode 100755 index 00000000..5ff59cf7 --- /dev/null +++ b/testsuite/systemtap.examples/io/ioblktime.stp @@ -0,0 +1,29 @@ +#! /usr/bin/env stap + +global req_time, etimes + +probe ioblock.request +{ + req_time[$bio] = gettimeofday_us() +} + +probe ioblock.end +{ + t = gettimeofday_us() + s = req_time[$bio] + delete req_time[$bio] + if (s) { + etimes[devname, bio_rw_str(rw)] <<< t - s + } +} + +probe timer.s(10), end { + printf("\033[2J\033[1;1H") /* clear screen */ + printf("%10s %3s %10s %10s %10s\n", + "device", "rw", "total (us)", "count", "avg (us)") + foreach ([dev,rw] in etimes - limit 20) { + printf("%10s %3s %10d %10d %10d\n", dev, rw, + @sum(etimes[dev,rw]), @count(etimes[dev,rw]), @avg(etimes[dev,rw])) + } + delete etimes +} -- 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. --- testsuite/systemtap.examples/io/ioblktime.stp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'testsuite/systemtap.examples/io') diff --git a/testsuite/systemtap.examples/io/ioblktime.stp b/testsuite/systemtap.examples/io/ioblktime.stp index 5ff59cf7..d6267b3e 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 */ + ansi_clear_screen() printf("%10s %3s %10s %10s %10s\n", "device", "rw", "total (us)", "count", "avg (us)") foreach ([dev,rw] in etimes - limit 20) { -- cgit From 3b735623b8c878f52e0945074b4be4cdcd0bc257 Mon Sep 17 00:00:00 2001 From: Key Meyer Date: Mon, 27 Apr 2009 18:36:32 -0400 Subject: traceio sample: tolerate more than a few hundred processes ... rather than exiting with MAXACTIONS exceeded --- testsuite/systemtap.examples/io/traceio.stp | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) (limited to 'testsuite/systemtap.examples/io') diff --git a/testsuite/systemtap.examples/io/traceio.stp b/testsuite/systemtap.examples/io/traceio.stp index 9e2deec6..a5d79fde 100755 --- a/testsuite/systemtap.examples/io/traceio.stp +++ b/testsuite/systemtap.examples/io/traceio.stp @@ -10,22 +10,20 @@ global reads, writes, total_io probe vfs.read.return { - reads[execname()] += $return + reads[pid(),execname()] += $return + total_io[pid(),execname()] += $return } probe vfs.write.return { - writes[execname()] += $return + writes[pid(),execname()] += $return + total_io[pid(),execname()] += $return } probe timer.s(1) { - foreach (p in reads) - total_io[p] += reads[p] - foreach (p in writes) - total_io[p] += writes[p] - foreach(p in total_io- limit 10) - printf("%15s r: %8d KiB w: %8d KiB\n", - p, reads[p]/1024, - writes[p]/1024) + foreach([p,e] in total_io- limit 10) + printf("%8d %15s r: %8d MiB w: %8d MiB\n", + p, e, reads[p,e]/1024/1024, + writes[p,e]/1024/1024) printf("\n") # Note we don't zero out reads, writes and total_io, # so the values are cumulative since the script started. -- cgit From 676c0d81a7d650c8c4e25a7a2495d2b19b50b2b8 Mon Sep 17 00:00:00 2001 From: Key Meyer Date: Mon, 27 Apr 2009 19:12:14 -0400 Subject: traceio: add human-readable byte-count output --- testsuite/systemtap.examples/io/traceio.stp | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) (limited to 'testsuite/systemtap.examples/io') diff --git a/testsuite/systemtap.examples/io/traceio.stp b/testsuite/systemtap.examples/io/traceio.stp index a5d79fde..875000cb 100755 --- a/testsuite/systemtap.examples/io/traceio.stp +++ b/testsuite/systemtap.examples/io/traceio.stp @@ -1,6 +1,9 @@ #! /usr/bin/env stap # traceio.stp # Copyright (C) 2007 Red Hat, Inc., Eugene Teo +# Copyright (C) 2009 Kai Meyer +# Fixed a bug that allows this to run longer +# And added the humanreadable function # # 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 @@ -19,11 +22,23 @@ probe vfs.write.return { total_io[pid(),execname()] += $return } +function humanreadable(bytes) { + if (bytes > 1024*1024*1024) { + return sprintf("%d GiB", bytes/1024/1024/1024) + } else if (bytes > 1024*1024) { + return sprintf("%d MiB", bytes/1024/1024) + } else if (bytes > 1024) { + return sprintf("%d KiB", bytes/1024) + } else { + return sprintf("%d B", bytes) + } +} + probe timer.s(1) { foreach([p,e] in total_io- limit 10) - printf("%8d %15s r: %8d MiB w: %8d MiB\n", - p, e, reads[p,e]/1024/1024, - writes[p,e]/1024/1024) + printf("%8d %15s r: %12s w: %12s\n", + p, e, humanreadable(reads[p,e]), + humanreadable(writes[p,e])) printf("\n") # Note we don't zero out reads, writes and total_io, # so the values are cumulative since the script started. -- cgit