This is the mail archive of the
systemtap@sourceware.org
mailing list for the systemtap project.
Re: How to inject sleep
- From: "Bryn M. Reeves" <bmr at redhat dot com>
- To: Nayan Gadre <beejoy dot nayan at gmail dot com>
- Cc: systemtap at sourceware dot org
- Date: Wed, 18 Apr 2018 13:04:59 +0100
- Subject: Re: How to inject sleep
- References: <CABTgHBvg84a7=cHwajDmcn61ksJ0Gq4+sKC+2UiedAFRxtTByg@mail.gmail.com>
On Wed, Apr 18, 2018 at 12:16:17PM +0530, Nayan Gadre wrote:
> probe module("llt").function("llt_send_data"){
> print("LLT_SEND_DATA\n");
> printf("Arguments: [Port: %u, Nid: %u, FragCount: %u,
> Frag_size: %u]\n", $port, $nid, $fcnt, $frags[0]->f_size);
> #printf("local variables %s and arguments %s\n", $$locals, $$vars)
> print_backtrace()
> print("-------------------------------\n")
> }
>
> So would like to inject msleep(10) after entering into this module
> function llt_send_data.
You can't sleep (since that would involve scheduling), but you can
brief busy-waits using the guru-delay tapset.
I wrote this a few years back to allow injecting short pauses into
driver code for fault simulation, and it's proven useful for a few
other situations since.
You should find it in /usr/share/systemtap/tapset/dyninst/guru-delay.stp
or so, and the functions provided are:
mdelay(ms)
udelay(us)
It does require guru-mode (-g) to use, since it can induce quite
dramatic system-wide side effects if used incautiosly.
Regards,
Bryn.