From d3a4bc8e677296e6a2a6c270f2c7663253041cc2 Mon Sep 17 00:00:00 2001 From: tpnguyen Date: Thu, 8 Jun 2006 23:12:28 +0000 Subject: *** empty log message *** --- tapset/ChangeLog | 4 +++ tapset/ioblock.stp | 77 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 81 insertions(+) create mode 100644 tapset/ioblock.stp diff --git a/tapset/ChangeLog b/tapset/ChangeLog index d6da0989..99f2a752 100644 --- a/tapset/ChangeLog +++ b/tapset/ChangeLog @@ -1,3 +1,7 @@ +2006-06-08 Thang Nguyen + + * ioblock.stp: new (block I/O activities) + 2006-06-06 Josh Stone * process.stp (create, exec_complete): replace retval() with $return diff --git a/tapset/ioblock.stp b/tapset/ioblock.stp new file mode 100644 index 00000000..746460cc --- /dev/null +++ b/tapset/ioblock.stp @@ -0,0 +1,77 @@ +// Block I/O tapset +// Copyright (C) 2006 Intel Corp. +// +// This file is part of systemtap, and is free software. You can +// redistribute it and/or modify it under the terms of the GNU General +// Public License (GPL); either version 2, or (at your option) any +// later version. + +%{ +#include +%} + +/* probe ioblock.submit + * + * Fires whenever a block I/O is submitted. + * + * Context: + * The process which submits block I/O + * + * Arguments: + * rw_string - string (READ/WRITE). + * rw - binary trace for read/write + * sector - beginning sector for the entire bio + * bio_devname - block device name + */ +probe ioblock.submit + = kernel.function("submit_bio") +{ + rw_string = bio_read_write($rw); + rw = $rw + sector = $bio->bi_sector + bio_devname = bio_devname($bio) +} + +/* probe ioblock.end + * + * Fires whenever a block I/O transfer is complete. + * + * Context: + * The process which signals the transfer is done. + * + * Arguments: + * rw_string - string (READ/WRITE). + * rw - binary trace for read/write + * sector - beginning sector for the entire bio + * bytes_done - number of bytes done + * error - success: 0 + * bio_devname - block device name + */ +probe ioblock.end + = kernel.function("bio_endio") +{ + rw_string = bio_read_write($bio->bi_rw) + rw = $bio->bi_rw + sector = $bio->bi_sector + bytes_done = $bytes_done; + error = $error; + bio_devname = bio_devname($bio) +} + + +/* Return the block device name */ +function bio_devname:string(bio:long) +%{ + char b[BDEVNAME_SIZE]; + struct bio *bp; + + bp = (struct bio *) ((unsigned long) THIS->bio); + bdevname(bp->bi_bdev,b); + sprintf(THIS->__retvalue,"%s",b); +%} + +/* Return a READ/WRITE status string */ +function bio_read_write:string(var_rw:long) +%{ + sprintf(THIS->__retvalue,"%s", (THIS->var_rw & WRITE) ? "WRITE" : "READ"); +%} -- cgit