diff options
| author | Steve Dickson <steved@redhat.com> | 2008-01-29 15:02:30 -0500 |
|---|---|---|
| committer | Steve Dickson <steved@redhat.com> | 2008-01-29 15:02:30 -0500 |
| commit | a0630d519e87f5c5d851d3127085a50592bb20b4 (patch) | |
| tree | 589aff766c2131f715b595de40ed19b57719b0cb /stap_tutorial-1.0/examples/read-write-2.stp | |
| download | systemtap-a0630d519e87f5c5d851d3127085a50592bb20b4.tar.gz systemtap-a0630d519e87f5c5d851d3127085a50592bb20b4.tar.xz systemtap-a0630d519e87f5c5d851d3127085a50592bb20b4.zip | |
Initial Commit
Diffstat (limited to 'stap_tutorial-1.0/examples/read-write-2.stp')
| -rwxr-xr-x | stap_tutorial-1.0/examples/read-write-2.stp | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/stap_tutorial-1.0/examples/read-write-2.stp b/stap_tutorial-1.0/examples/read-write-2.stp new file mode 100755 index 0000000..d6a647b --- /dev/null +++ b/stap_tutorial-1.0/examples/read-write-2.stp @@ -0,0 +1,27 @@ +#!/usr/bin/env stap + +global reads, writes + +probe begin { + printf("Collecting data...\n") +} + +probe syscall.read.return { + if ($return > 0) + reads[execname()] += $return +} + +probe syscall.write.return { + if ($return > 0) + writes[execname()] += $return +} + +probe end { + printf("Bytes read by process name:\n") + foreach (name in reads-) + printf("%10d %s\n", reads[name], name) + + printf("Bytes written by process name:\n") + foreach (name in writes-) + printf("%10d %s\n", writes[name], name) +} |
