diff options
author | William Cohen <wcohen@localhost.localdomain> | 2008-04-24 12:20:13 -0400 |
---|---|---|
committer | William Cohen <wcohen@localhost.localdomain> | 2008-04-24 12:20:13 -0400 |
commit | 7f79ea13a0f64573ce13353257d322ae49ef0c27 (patch) | |
tree | 60de8da5af4c2bcc26abfb9430fdca66bdc20b98 /examples/iostat-scsi.stp | |
parent | f90f92615df6ff2a62282359281889597e5dbf17 (diff) | |
download | systemtap-steved-7f79ea13a0f64573ce13353257d322ae49ef0c27.tar.gz systemtap-steved-7f79ea13a0f64573ce13353257d322ae49ef0c27.tar.xz systemtap-steved-7f79ea13a0f64573ce13353257d322ae49ef0c27.zip |
Move examples to testsuite/systemtap.examples
Diffstat (limited to 'examples/iostat-scsi.stp')
-rwxr-xr-x | examples/iostat-scsi.stp | 81 |
1 files changed, 0 insertions, 81 deletions
diff --git a/examples/iostat-scsi.stp b/examples/iostat-scsi.stp deleted file mode 100755 index ef778e53..00000000 --- a/examples/iostat-scsi.stp +++ /dev/null @@ -1,81 +0,0 @@ -#! /usr/bin/env stap - -global devices, reads, writes - -/* data collection: SCSI disk */ -%(kernel_v<"2.6.24" %? -probe module("sd_mod").function("sd_init_command") !, kernel.function("sd_init_command") { - device=kernel_string($SCpnt->request->rq_disk->disk_name) - sector_size=$SCpnt->device->sector_size - nr_sectors=$SCpnt->request->nr_sectors - devices[device] = 1 -%(kernel_v>="2.6.19" %? - if ($SCpnt->request->cmd_flags & 1) -%: - if ($SCpnt->request->flags & 1) -%) - writes[device] <<< nr_sectors * sector_size - else - reads[device] <<< nr_sectors * sector_size -} -%: -%{ -#include <scsi/scsi_device.h> -%} - -function get_sector_size:long (data:long) %{ /* pure */ - struct scsi_device *sdp = (struct scsi_device *)((long)THIS->data); - THIS->__retvalue = kread(&(sdp->sector_size)); - CATCH_DEREF_FAULT(); -%} - -probe module("sd_mod").function("sd_prep_fn") !, kernel.function("sd_prep_fn") { - device=kernel_string($rq->rq_disk->disk_name) - sector_size=get_sector_size($q->queuedata) - nr_sectors=$rq->nr_sectors - devices[device] = 1 - if ($rq->cmd_flags & 1) - writes[device] <<< nr_sectors * sector_size - else - reads[device] <<< nr_sectors * sector_size -} -%) - -/* data collection: SCSI tape */ -probe module("st").function("st_do_scsi") !, kernel.function("st_do_scsi") { - device=kernel_string($STp->disk->disk_name) - devices[device] = 1 - if ($direction) - writes[device] <<< $bytes - else - reads[device] <<< $bytes -} - - -/* reporting */ -global blksize=512 -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") - - foreach (dev in devices) { - rdcount=@count(reads[dev]) - wrcount=@count(writes[dev]) - tps=(rdcount+wrcount)*100/$1 - rdblkcount=rdcount ? @sum(reads[dev])/blksize : 0 - wrblkcount=wrcount ? @sum(writes[dev])/blksize : 0 - 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) - } - printf ("\n") - delete devices - delete reads - delete writes -} |