views:

218

answers:

2

How can I do the lock profiling (spin and other kind of locks) in 2.6 Linux kernel? I want to get the lock contention numbers for few locks which I have added in my module. Is there any .config option which I can enable and get the profile or any other tool?

A: 

OProfile's docs say that you can use it to profile the kernel. Though, it seems there is a better alternative - compiling the kernel with the following config option:

CONFIG_LOCK_STAT=y

There's a blog entry describing it in more details.

Full Disclaimer - I did not try it myself, merely read about it.

Andrew Y
+1  A: 

Andrew Thanks for good pointer.

Looks like oprofile cannot give lock statistics. CONFIG_LOCK_STAT is present only after 2.6.23 kernel. While my kernel version is 2.6.16. If kernel version is <2.6.23 then lockmeter patch (http://oss.sgi.com/projects/lockmeter/) is the option.

Marc M