diff options
author | William Cohen <wcohen@redhat.com> | 2008-12-09 11:20:11 -0500 |
---|---|---|
committer | William Cohen <wcohen@redhat.com> | 2008-12-09 11:20:11 -0500 |
commit | 4ffc629674ac7d1d84b93cb7fdca71953983f762 (patch) | |
tree | dca338602903ba87b69592b40faa35ca74b7966e /testsuite/systemtap.examples/io | |
parent | 73dc0c77745ee09db15542c14f7e048f91e121e6 (diff) | |
download | systemtap-steved-4ffc629674ac7d1d84b93cb7fdca71953983f762.tar.gz systemtap-steved-4ffc629674ac7d1d84b93cb7fdca71953983f762.tar.xz systemtap-steved-4ffc629674ac7d1d84b93cb7fdca71953983f762.zip |
Tweak formatting, indent two space.
Diffstat (limited to 'testsuite/systemtap.examples/io')
-rwxr-xr-x | testsuite/systemtap.examples/io/disktop.stp | 80 | ||||
-rwxr-xr-x | testsuite/systemtap.examples/io/io_submit.stp | 50 | ||||
-rwxr-xr-x | testsuite/systemtap.examples/io/iostat-scsi.stp | 10 | ||||
-rwxr-xr-x | testsuite/systemtap.examples/io/iotime.stp | 7 | ||||
-rwxr-xr-x | testsuite/systemtap.examples/io/traceio.stp | 26 | ||||
-rwxr-xr-x | testsuite/systemtap.examples/io/traceio2.stp | 6 |
6 files changed, 90 insertions, 89 deletions
diff --git a/testsuite/systemtap.examples/io/disktop.stp b/testsuite/systemtap.examples/io/disktop.stp index 238195bf..db91f2be 100755 --- a/testsuite/systemtap.examples/io/disktop.stp +++ b/testsuite/systemtap.examples/io/disktop.stp @@ -16,56 +16,56 @@ global io_stat,device global read_bytes,write_bytes probe vfs.read.return { - if ($return>0) { - if (devname!="N/A") {/*skip read from cache*/ - io_stat[pid(),execname(),uid(),ppid(),"R"] += $return - device[pid(),execname(),uid(),ppid(),"R"] = devname - read_bytes += $return - } - } + if ($return>0) { + if (devname!="N/A") {/*skip read from cache*/ + io_stat[pid(),execname(),uid(),ppid(),"R"] += $return + device[pid(),execname(),uid(),ppid(),"R"] = devname + read_bytes += $return + } + } } probe vfs.write.return { - if ($return>0) { - if (devname!="N/A") { /*skip update cache*/ - io_stat[pid(),execname(),uid(),ppid(),"W"] += $return - device[pid(),execname(),uid(),ppid(),"W"] = devname - write_bytes += $return - } - } + if ($return>0) { + if (devname!="N/A") { /*skip update cache*/ + io_stat[pid(),execname(),uid(),ppid(),"W"] += $return + device[pid(),execname(),uid(),ppid(),"W"] = devname + write_bytes += $return + } + } } probe timer.ms(5000) { - /* skip non-read/write disk */ - if (read_bytes+write_bytes) { + /* skip non-read/write disk */ + if (read_bytes+write_bytes) { - printf("\n%-25s, %-8s%4dKb/sec, %-7s%6dKb, %-7s%6dKb\n\n", - ctime(gettimeofday_s()), - "Average:", ((read_bytes+write_bytes)/1024)/5, - "Read:",read_bytes/1024, - "Write:",write_bytes/1024) + printf("\n%-25s, %-8s%4dKb/sec, %-7s%6dKb, %-7s%6dKb\n\n", + ctime(gettimeofday_s()), + "Average:", ((read_bytes+write_bytes)/1024)/5, + "Read:",read_bytes/1024, + "Write:",write_bytes/1024) - /* print header */ - printf("%8s %8s %8s %25s %8s %4s %12s\n", - "UID","PID","PPID","CMD","DEVICE","T","BYTES") - } - /* print top ten I/O */ - foreach ([process,cmd,userid,parent,action] in io_stat- limit 10) - printf("%8d %8d %8d %25s %8s %4s %12d\n", - userid,process,parent,cmd, - device[process,cmd,userid,parent,action], - action,io_stat[process,cmd,userid,parent,action]) + /* print header */ + printf("%8s %8s %8s %25s %8s %4s %12s\n", + "UID","PID","PPID","CMD","DEVICE","T","BYTES") + } + /* print top ten I/O */ + foreach ([process,cmd,userid,parent,action] in io_stat- limit 10) + printf("%8d %8d %8d %25s %8s %4s %12d\n", + userid,process,parent,cmd, + device[process,cmd,userid,parent,action], + action,io_stat[process,cmd,userid,parent,action]) - /* clear data */ - delete io_stat - delete device - read_bytes = 0 - write_bytes = 0 + /* clear data */ + delete io_stat + delete device + read_bytes = 0 + write_bytes = 0 } probe end{ - delete io_stat - delete device - delete read_bytes - delete write_bytes + delete io_stat + delete device + delete read_bytes + delete write_bytes } diff --git a/testsuite/systemtap.examples/io/io_submit.stp b/testsuite/systemtap.examples/io/io_submit.stp index 13dcc5a3..fc2e5ff1 100755 --- a/testsuite/systemtap.examples/io/io_submit.stp +++ b/testsuite/systemtap.examples/io/io_submit.stp @@ -21,19 +21,19 @@ global traces * hash table that this proc is in io_submit */ probe syscall.io_submit { - in_iosubmit[tid()] = 1 + in_iosubmit[tid()] = 1 } /* * when we return from sys_io_submit, record that we're no longer there */ probe syscall.io_submit.return { - /* this assumes a given proc will do lots of io_submit calls, and - * so doesn't do the more expensive "delete in_iosubmit[p]". If - * there are lots of procs doing small number of io_submit calls, - * the hash may grow pretty big, so using delete may be better - */ - in_iosubmit[tid()] = 0 + /* this assumes a given proc will do lots of io_submit calls, and + * so doesn't do the more expensive "delete in_iosubmit[p]". If + * there are lots of procs doing small number of io_submit calls, + * the hash may grow pretty big, so using delete may be better + */ + in_iosubmit[tid()] = 0 } /* @@ -41,21 +41,21 @@ probe syscall.io_submit.return { * io_submit. If so, record our backtrace into the traces histogram */ probe kernel.function("schedule") { - if (tid() in in_iosubmit) { - traces[backtrace()]++ + if (tid() in in_iosubmit) { + traces[backtrace()]++ - /* - * change this to if (1) if you want a backtrace every time - * you go into schedule from io_submit. Unfortunately, the traces - * saved into the traces histogram above are truncated to just a - * few lines. so the only way to see the full trace is via the - * more verbose print_backtrace() right here. - */ - if (0) { - printf("schedule in io_submit!\n") - print_backtrace() - } - } + /* + * change this to if (1) if you want a backtrace every time + * you go into schedule from io_submit. Unfortunately, the traces + * saved into the traces histogram above are truncated to just a + * few lines. so the only way to see the full trace is via the + * more verbose print_backtrace() right here. + */ + if (0) { + printf("schedule in io_submit!\n") + print_backtrace() + } + } } /* @@ -63,9 +63,9 @@ probe kernel.function("schedule") { * trace paths and print the 30 most common. */ probe end { - foreach (stack in traces- limit 30) { - printf("%d:", traces[stack]) - print_stack(stack); - } + foreach (stack in traces- limit 30) { + printf("%d:", traces[stack]) + print_stack(stack); + } } diff --git a/testsuite/systemtap.examples/io/iostat-scsi.stp b/testsuite/systemtap.examples/io/iostat-scsi.stp index ef778e53..15833af8 100755 --- a/testsuite/systemtap.examples/io/iostat-scsi.stp +++ b/testsuite/systemtap.examples/io/iostat-scsi.stp @@ -58,7 +58,7 @@ global hdrcount probe timer.s($1) { if ((hdrcount++ % 10) == 0) printf("%9s %9s %9s %9s %9s %9s\n", - "Device:","tps","blk_read/s","blk_wrtn/s","blk_read","blk_wrtn") + "Device:","tps","blk_read/s","blk_wrtn/s","blk_read","blk_wrtn") foreach (dev in devices) { rdcount=@count(reads[dev]) @@ -69,10 +69,10 @@ probe timer.s($1) { rdblkrate=rdblkcount*100/$1 wrblkrate=wrblkcount*100/$1 printf("%9s %6d.%02d %6d.%02d %6d.%02d %9d %9d\n", - dev, tps/100,tps%100, - rdblkrate/100,rdblkrate%100, - wrblkrate/100,wrblkrate%100, - rdblkcount, wrblkcount) + dev, tps/100,tps%100, + rdblkrate/100,rdblkrate%100, + wrblkrate/100,wrblkrate%100, + rdblkcount, wrblkcount) } printf ("\n") delete devices diff --git a/testsuite/systemtap.examples/io/iotime.stp b/testsuite/systemtap.examples/io/iotime.stp index 4fbd6b6e..60fb09af 100755 --- a/testsuite/systemtap.examples/io/iotime.stp +++ b/testsuite/systemtap.examples/io/iotime.stp @@ -98,11 +98,12 @@ probe syscall.write.return { probe syscall.close { if (filehandles[pid(), $fd] != "") { - printf("%d %s access %s read: %d write: %d\n", timestamp(), proc(), - filehandles[pid(), $fd], fileread[pid(), $fd], filewrite[pid(), $fd]) + printf("%d %s access %s read: %d write: %d\n", + timestamp(), proc(), filehandles[pid(), $fd], + fileread[pid(), $fd], filewrite[pid(), $fd]) if (@count(time_io[pid(), $fd])) printf("%d %s iotime %s time: %d\n", timestamp(), proc(), - filehandles[pid(), $fd], @sum(time_io[pid(), $fd])) + filehandles[pid(), $fd], @sum(time_io[pid(), $fd])) } delete fileread[pid(), $fd] delete filewrite[pid(), $fd] diff --git a/testsuite/systemtap.examples/io/traceio.stp b/testsuite/systemtap.examples/io/traceio.stp index 4ca4dd4c..9e2deec6 100755 --- a/testsuite/systemtap.examples/io/traceio.stp +++ b/testsuite/systemtap.examples/io/traceio.stp @@ -10,23 +10,23 @@ global reads, writes, total_io probe vfs.read.return { - reads[execname()] += $return + reads[execname()] += $return } probe vfs.write.return { - writes[execname()] += $return + writes[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) - printf("\n") - # Note we don't zero out reads, writes and total_io, - # so the values are cumulative since the script started. + 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) + printf("\n") + # Note we don't zero out reads, writes and total_io, + # so the values are cumulative since the script started. } diff --git a/testsuite/systemtap.examples/io/traceio2.stp b/testsuite/systemtap.examples/io/traceio2.stp index a9d3c261..032edcd9 100755 --- a/testsuite/systemtap.examples/io/traceio2.stp +++ b/testsuite/systemtap.examples/io/traceio2.stp @@ -11,7 +11,7 @@ probe begin { probe vfs.write, vfs.read { - if (dev == device_of_interest) - printf ("%s(%d) %s 0x%x\n", - execname(), pid(), probefunc(), dev) + if (dev == device_of_interest) + printf ("%s(%d) %s 0x%x\n", + execname(), pid(), probefunc(), dev) } |