Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 14 Dec 2009 06:33:45 -0600
From:      Stacey Son <sson@FreeBSD.org>
To:        Julian Elischer <julian@elischer.org>
Cc:        FreeBSD Current <current@freebsd.org>
Subject:   Re: profiling kernel modules.
Message-ID:  <3498D1C3-3330-463E-9D9E-2A487185F46C@FreeBSD.org>
In-Reply-To: <4B25D32B.70306@elischer.org>
References:  <4B25D32B.70306@elischer.org>

next in thread | previous in thread | raw e-mail | index | archive | help

On Dec 13, 2009, at 11:54 PM, Julian Elischer wrote:

> It's been a few years since I last profiled the kernel, (probably a =
decade :-)  but it was always a monolithic compiled kernel. Now I want =
to profile a module, but I'm not finding a lot of specific instructions =
as to how to do this, For example how to get the loaded addresses for  =
the modules taken into account, or what arguments need to be added to =
the compile of the module to make sure it has any code stubs that may be =
needed, etc.
>=20
> if you know anything about these subjects, or related (e.g. usin
> the performance counters in the kernel/modules I'd love to get your =
inpout and maybe turn out a doc on how to do this.
>=20
> This would be for -current (9) or 8.0R.



Hi Julian:

You might want to take a look at using the  'lockstat' command, in =
particular its '-I' option (see =
http://docs.sun.com/app/docs/doc/816-5212/6mbcdgk0m?a=3Dview  or =
lockstat(1)).    lockstat depends on the dtrace and the pseudo driver =
ksyms bits in the kernel.   The ksyms driver provides lockstat with a =
complete symbol table (including all the symbols of any loaded kernel =
modules).   See http://people.freebsd.org/~sson/ksyms/ksyms.4.txt or =
ksyms(4).

See http://wiki.freebsd.org/DTrace for adding the dtrace bits and add =
'device ksyms' to your kernel config file.  You will need to load both =
the 'dtraceall' and 'ksyms' kernel modules before you can successfully =
use the 'lockstat' command.

Best Regards,

-stacey.




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?3498D1C3-3330-463E-9D9E-2A487185F46C>