diff options
author | William Cohen <wcohen@redhat.com> | 2009-02-06 17:44:23 -0500 |
---|---|---|
committer | William Cohen <wcohen@redhat.com> | 2009-02-06 17:44:23 -0500 |
commit | 3e4444ed0b5367ee58c89685c2ee072abc185737 (patch) | |
tree | 9c2d1cc0976246467834d39b1c48b17a837b428c /testsuite/systemtap.examples/io | |
parent | 5c54d49ebb4da71680cb45e3be221e11b9b8d364 (diff) | |
download | systemtap-steved-3e4444ed0b5367ee58c89685c2ee072abc185737.tar.gz systemtap-steved-3e4444ed0b5367ee58c89685c2ee072abc185737.tar.xz systemtap-steved-3e4444ed0b5367ee58c89685c2ee072abc185737.zip |
Fold the systemtap.samples/iotask*.stp into systemtap.examples/io/iostats.stp.
Regenerate the catalog information.
Diffstat (limited to 'testsuite/systemtap.examples/io')
-rw-r--r-- | testsuite/systemtap.examples/io/iostats.meta | 13 | ||||
-rw-r--r-- | testsuite/systemtap.examples/io/iostats.stp | 44 |
2 files changed, 57 insertions, 0 deletions
diff --git a/testsuite/systemtap.examples/io/iostats.meta b/testsuite/systemtap.examples/io/iostats.meta new file mode 100644 index 00000000..a74c9fe4 --- /dev/null +++ b/testsuite/systemtap.examples/io/iostats.meta @@ -0,0 +1,13 @@ +title: List Executables Reading and Writing the Most Data +name: iostats.stp +version: 1.0 +author: anonymous +keywords: io profiling +subsystem: io +status: production +exit: user-controlled +output: sorted-list +scope: system-wide +description: The iostat.stp script measures the amount of data successfully read and written by all the executables on the system. The output is sorted from most greatest sum of bytes read and written by an executable to the least. The output contains the count of operations (opens, reads, and writes), the totals and averages for the number of bytes read and written. +test_check: stap -p4 iostats.stp +test_installcheck: stap iostats.stp -c "sleep 1" diff --git a/testsuite/systemtap.examples/io/iostats.stp b/testsuite/systemtap.examples/io/iostats.stp new file mode 100644 index 00000000..90bb4f5b --- /dev/null +++ b/testsuite/systemtap.examples/io/iostats.stp @@ -0,0 +1,44 @@ +#! /usr/bin/env stap +global opens, reads, writes, totals + +probe begin { printf("starting probe\n") } + +probe syscall.open { + e=execname(); + opens[e] <<< 1 # statistics array +} + +probe syscall.read.return { + count = $return + if ( count >= 0 ) { + e=execname(); + reads[e] <<< count # statistics array + totals[e] += count + } +} + +probe syscall.write.return { + count = $return + if (count >= 0 ) { + e=execname(); + writes[e] <<< count # statistics array + totals[e] += count + } +} + +probe end { + printf("\n%16s %8s %8s %8s %8s %8s %8s %8s\n", + "", "", "", "read", "read", "", "write", "write") + printf("%16s %8s %8s %8s %8s %8s %8s %8s\n", + "name", "open", "read", "KB tot", "B avg", "write", "KB tot", "B avg") + foreach (name in totals- limit 20) { # sort by total io + printf("%16s %8d %8d %8d %8d %8d %8d %8d\n", + name, @count(opens[name]), + @count(reads[name]), + (@count(reads[name]) ? @sum(reads[name])>>10 : 0 ), + (@count(reads[name]) ? @avg(reads[name]) : 0 ), + @count(writes[name]), + (@count(writes[name]) ? @sum(writes[name])>>10 : 0 ), + (@count(writes[name]) ? @avg(writes[name]) : 0 )) + } +} |