设为首页 加入收藏

TOP

Linux Kernel 当前运行中 锁的状态信息
2014-11-24 14:16:51 来源: 作者: 【 】 浏览:1
Tags:Linux Kernel 当前 运行 状态 信息

Linux Kernel 当前运行中 锁的状态信息【适用于调试模式】。


俺的设备死机的时候,发现是因为锁导致的,这时候相当郁闷的是没地方看系统相关锁的信息,当找到内核文档下的相关信息后,


大惊:原来开发者已经为俺考虑好这些东东了:进入调试模式就是这么简单:


锁统计信息信息
LOCK STATISTICS


- WHY
锁竞争会严重地影响性能和表现
Because things like lock contention can severely impact performance.


- HOW
如何实现


Lockdep already has hooks in the lock functions and maps lock instances to
lock classes. We build on that. The graph below shows the relation between
the lock functions and the various hooks therein.



__acquire
|
lock _____
| \
| __contended
| |
|
| _______/
|/
|
__acquired
|
.

.
|
__release
|
unlock



lock, unlock - the regular lock functions
__* - the hooks
<> - states


With these hooks we provide the following statistics:
con-bounces - number of lock contention that involved x-cpu data
contentions - number of lock acquisitions that had to wait
wait time min - shortest (non-0) time we ever had to wait for a lock
max - longest time we ever had to wait for a lock
total - total time we spend waiting on this lock
acq-bounces - number of lock acquisitions that involved x-cpu data
acquisitions - number of times we took the lock
hold time min - shortest (non-0) time we ever held the lock
max - longest time we ever held the lock
total - total time this lock was held


From these number various other statistics can be derived, such as:


hold time average = hold time total / acquisitions


These numbers are gathered per lock class, per read/write state (when
applicable).



It also tracks 4 contention points per class. A contention point is a call site
that had to wait on lock acquisition.


- USAGE


Look at the current lock statistics:


( line numbers not part of actual output, done for clarity in the explanation
below )


# less /proc/lock_stat


】【打印繁体】【投稿】【收藏】 【推荐】【举报】【评论】 【关闭】 【返回顶部
分享到: 
上一篇Linux下汇编调试器GDB的使用 下一篇Java 独立模块启动脚本

评论

帐  号: 密码: (新用户注册)
验 证 码:
表  情:
内  容: