This is the mail archive of the systemtap@sourceware.org mailing list for the systemtap project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [Fwd: Re: Accuracy of disk statistics IO counter]


Alan D. Brunelle ??:
Here's a "success story" with SystemTAP: a developer here was having trouble with getting iostat results to match internal tools he was working on, and with the help of a _very_ simple SystemTAP script, he was able to determine the nature of the problem, and get going very quickly...

Alan
PS. Here's the script I started him with...

global rqs
global lun, id, channel, host_no

probe begin
{
       host_no = 0
       channel = 0
       id = 7
       lun = 12
}

probe module("*scsi_mod*").function("scsi_dispatch_cmd")
{
       if (1       != $cmd->sc_data_direction) next
       if (lun     != $cmd->device->lun) next
       if (id      != $cmd->device->id) next
       if (channel != $cmd->device->channel) next
       if (host_no != $cmd->device->host->host_no) next

       rqs[$cmd->request_bufflen / 1024]++
}

probe end
{
       foreach (rec+ in rqs)
             printf("%d %d\n", rec, rqs[rec])
       exit()
}


An excellent example. But actually systemtap already has the same probe point of scsi_dispatch_cmd defined in /usr/share/systemtap/tapset/scsi.stp. With that tapsets, you can just:


global rqs
global _lun, _id, _channel, _host_no

probe begin
{
       _host_no = 0
       _channel = 0
       _id = 7
       _lun = 12
}

probe scsi.iodispatching
{
       if (1       != data_direction) next
       if (_lun     != lun) next
       if (_id      != dev_id) next
       if (_channel != channel) next
       if (_host_no != host_no) next

       rqs[req_bufflen / 1024]++
}

probe end
{
       foreach (rec+ in rqs)
             printf("%d %d\n", rec, rqs[rec])
       exit()
}

And this is what BZ 2949 "need 'probe listing' command line option" aims for. We should make the stap users aware of current implemented stap probes instead of letting them start from scratch. I will add a section of "PROBE LIST" in stapprobes(5) man page and start to document the tapsets checked in. How about it?

- Guanglei


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]