How to profile a driver

John Baldwin jhb at freebsd.org
Tue Jan 31 12:24:35 PST 2006


On Monday 30 January 2006 12:32, Bharma Ji wrote:
> I am trying to optimize a driver for performance. What are the standard
> ways to profile a driver?
>
>  My problem at the moment is that when I run a test and max out the CPU,
> then the system % is 60 and user % is 30. I wanted to find out how much
> time is being spent in the driver(and within it, if possible in what
> components). Can this be determined and if so, how to figure this out.

There aren't currently any really good tools for this, but one very useful 
thing you can try is including KTR in your kernel and turn on KTR_SCHED 
traces while you run your test, then use ktrdump to dump the events to a file 
and use schedgraph.py to look at the results, it will pop up a window showing 
you the scheduler activity (which threads ran when and for how-long, etc.) on 
a timeline.

-- 
John Baldwin <jhb at FreeBSD.org>  <><  http://www.FreeBSD.org/~jhb/
"Power Users Use the Power to Serve"  =  http://www.FreeBSD.org


More information about the freebsd-drivers mailing list