diff options
author | dsmith <dsmith> | 2008-03-05 16:28:42 +0000 |
---|---|---|
committer | dsmith <dsmith> | 2008-03-05 16:28:42 +0000 |
commit | 979f400dad0159aab8c3aaa846db4ba312daef0a (patch) | |
tree | 225a1506066bee873fbed981bbba8cc5609353a2 /examples/iostat-scsi.stp | |
parent | e523ec99f2243055c688041ee2adbf5bb661333b (diff) | |
download | systemtap-steved-979f400dad0159aab8c3aaa846db4ba312daef0a.tar.gz systemtap-steved-979f400dad0159aab8c3aaa846db4ba312daef0a.tar.xz systemtap-steved-979f400dad0159aab8c3aaa846db4ba312daef0a.zip |
2008-03-05 David Smith <dsmith@redhat.com>
PR5422
* iostat-scsi.stp: Updated to handle kernel versions > 2.6.24.
* iostat-scsi.txt: Updated.
Diffstat (limited to 'examples/iostat-scsi.stp')
-rwxr-xr-x | examples/iostat-scsi.stp | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/examples/iostat-scsi.stp b/examples/iostat-scsi.stp index a65ec3f7..ef778e53 100755 --- a/examples/iostat-scsi.stp +++ b/examples/iostat-scsi.stp @@ -3,6 +3,7 @@ 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 @@ -17,6 +18,29 @@ probe module("sd_mod").function("sd_init_command") !, kernel.function("sd_init_c 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) |