This is the mail archive of the
systemtap@sources.redhat.com
mailing list for the systemtap project.
Re: kprobe example watching block device access
- From: "Frank Ch. Eigler" <fche at redhat dot com>
- To: systemtap at sources dot redhat dot com
- Date: Tue, 22 Feb 2005 21:01:44 -0500
- Subject: Re: kprobe example watching block device access
- References: <421BC74D.9020509@redhat.com>
Hi -
wcohen wrote:
> I have an example module working tracking the number of
> generic_make_request() calls and sectors transferred on a per device
> basis. It takes advantage of the current serial nature of the kprobe
> execution. [...]
To me, the remarkable aspects about this example are:
- how much shorter and more robust this should be in systemtap script
rather than C. It should be only a handful of lines total:
#! /usr/bin/stap
probe kernel::function("generic_make_request") {
count_generic_make_request ++;
sectors_transferred += /*bio_sectors(bio)*/;
bin_bdev[bio] = /*bio->bi_bdev*/;
bin_bd_dev[bio] = /*bio->bi_bdev->bd_dev*/;
++bin_count[bio];
bin_sectors[bio] += /*bio_sectors(bio)*/;
}
global bin_bdev, bin_bd_dev, bin_count, bin_sectors;
global count_generic_make_request, sectors_transferred;
- how important it is to be able to dereference C data structures
(the struct bio *) from within such a script. I don't have a
clear idea yet about how best to express such operations, either
specialized or generalized. (Thus the /* */ stuff above.)
Someone still needs to dwelve into the whole "provider" concept,
which is closely related.
- FChE