Ktrace'ing kernel threads

Fernando Gleiser fergleiser at yahoo.com
Mon Feb 15 14:53:21 UTC 2010


----- Original Message ----
> From: Shrikanth Kamath <shrikanth07 at gmail.com>
> To: freebsd-hackers at freebsd.org
> Sent: Mon, February 15, 2010 8:21:40 AM
> Subject: Ktrace'ing kernel threads
> 
> Can ktrace trace another kernel thread which has roughly the semantics as
> below, right now it
> does not hit any of the designated interesting points that ktrace is built
> for, but what if I could define those,
> will ktrace still allow tracing another kernel thread?


Yo can do that easily with dtrace

#!/usr/sbin/dtrace -s

fbt::build_msg:entry
{
         printf("%d\n", timestamp)
}

fbt::build_msg:return
{
         printf("%d\n", timestamp)
}


or if you want to get an histogram of the call time distributions:

fbt::build_msg:entry
{
         self->ts=timestamp;
}

fbt::build_msg:return
{
         @[probefunc]=quantize(timestamp - self->ts);
}


Those are from the top of my head, I don't have a FreeBSD system at hand to test them, but I hope you'll get the idea


Fer


      


More information about the freebsd-hackers mailing list