2.6 linux内核中的锁定分析

时间:2022-01-21 18:20:19

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?

如何在2.6 Linux内核中进行锁定分析(旋转和其他类型的锁定)?我想得到我在模块中添加的几个锁的锁争用数字。是否有任何.config选项可以启用并获取配置文件或任何其他工具?

2 个解决方案

#1


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.

看起来oprofile不能给出锁定统计信息。 CONFIG_LOCK_STAT仅在2.6.23内核之后出现。虽然我的内核版本是2.6.16。如果内核版本<2.6.23,则可以选择lockmeter补丁(http://oss.sgi.com/projects/lockmeter/)。

#2


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:

OProfile的文档说你可以使用它来分析内核。虽然,似乎有一个更好的选择 - 使用以下配置选项编译内核:

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.

完全免责声明 - 我没有亲自尝试,只是阅读它。

#1


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.

看起来oprofile不能给出锁定统计信息。 CONFIG_LOCK_STAT仅在2.6.23内核之后出现。虽然我的内核版本是2.6.16。如果内核版本<2.6.23,则可以选择lockmeter补丁(http://oss.sgi.com/projects/lockmeter/)。

#2


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:

OProfile的文档说你可以使用它来分析内核。虽然,似乎有一个更好的选择 - 使用以下配置选项编译内核:

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.

完全免责声明 - 我没有亲自尝试,只是阅读它。