FreeBSD kernel lock profiling

I recently discovered that FreeBSD has a neat way of doing kernel lock profiling. To use it you just need to add a single line in your kernel config script:

options  LOCK_PROFILING

Rebuild, install and reboot your new kernel. To check if it's working call sysctl debug.lock, you should see some options. Now try:

> sysctl debug.lock.prof.enable=1

> (launch a program or just wait a few seconds)

> sysctl debug.lock.prof.enable=0

> sysctl debug.lock.prof.stats

The stats include: file:line and lock type, maximum time held, total time held, total wait time, count, average time held, average wait time, contention while holding, contention while locking

Posted by Daniel Tralamazza on Monday 19 January 2009 at 15:38
Comments
RSS