This is the mail archive of the
systemtap@sourceware.org
mailing list for the systemtap project.
Re: [UPDATE] Linux Kernel Event Trace tool(LKET)
Li Guanglei ??:
[...]
So I'd like to break LKET's tapsets into the following two layers:
<1> Generic Tapsets
The first layer are generic tapsets which could not only be used for
tracing, but also for general purpose diagnosis. It will include the
probe points defined in current LKET's tapsets and some stap script
statements of getting the interesting data related to that event.
So this will need some .stp files to be added into
/usr/local/share/SystemTap/tapsets. These files are scsi.stp,
ioscheduler.stp, tskdispatching.stp, networking.stp etc. Take an example
of scsi.stp, it will look like:
...
probe scsi.ioentry
= module("*").function("scsi_prep_fn@drivers/scsi/scsi_lib.c")
{
disk_major = $rq->rq_disk->major
disk_minor = $rq->rq_disk->>first_minor
dev_state = $q->queuedata->sdev_state
// maybe a argstr?
}
...
These stp scripts not only address where inside the kernel to be
instrumented, but also get out the interesting data related to that
probed points. They look in the same style as current syscall.stp
shipped with SystemTap.
I've checked them into tapset directory(together with some testcases),
They are:
ioscheduler.stp, memory.stp, networking.stp, scsi.stp,
tskschedule.stp & process.stp from LKET were merged into scheduler.stp
and process.stp respectively.
In a summary, the following probe alias are defined:
ioscheduler.stp:
ioscheduler.elv_next_request
ioscheduler.elv_add_request
ioscheduler.elv_completed_request
memory.stp
pagefault
networking.stp
netdev.receive
netdev.transmit
scsi.stp
scsi.ioentry
scsi.iodispatching
scsi.iodone
scsi.iocompleted
scheduler.stp
scheduler.ctxswitch
You can refer to the .stp files for more info
<2> Tapsets Specific to Tracing
The second part will be tracing specific, which may be located in
/usr/local/share/systemtap/tapsets/LKET/. They include those embedded c
functions in current LKET. Take an example of scsi.stp:
probe addevent.scsi.ioentry
= probe scsi.ioentry
{
log_scsi_ioentry(HOOKID_SCSI_IOENTRY, $q, $req, backtrace)
}
Thanks to the optimizations of translator, the statements of "disk_major
= $rq->rq_disk->major" will be compiled away and the generated c file
will look exactly like the original LKET.
And "stap -bM -I /usr/local/share/SystemTap/tapsets/LKET sample.stp"
will work the same as current LKET.
--Guanglei
All these traceing specific tapsets are checked into tapset/LKET direcotry
I am writing the man pages for lket to make it easier to use.