Re: system cpu load monitoring q
Alexander Burnos <alex@localhost.org.ua> wrote:
> Здравствуйте!
[....]
> Thread dump сделать не получается, потому что во-первых очень тяжело
> отловить такие моменты и сразу сделать thread dump, а во-вторых иногда
> просто не попасть на сервер во время такого лоада.
> Поэтому вопрос, может быть есть какой-то механизм вроде accounting'а,
> только который бы отслеживал что именно дергается в system context'е?
oprofile ?
или так:
2.10 Profiling the kernel
There are several facilities to see where the kernel spends its resources. A
simple one is the profiling function, that stores the current EIP
(instruction pointer) at each clock tick.
Boot the kernel with command line option profile=2 (or some other number
instead of 2). This will cause a file /proc/profile to be created. The
number given after profile= is the number of positions EIP is shifted right
when profiling. So a large number gives a coarse profile. The counters are
reset by writing to /proc/profile. The utility readprofile will output
statistics for you. It does not sort - you have to invoke sort explicitly.
But given a memory map it will translate addresses to kernel symbols.
See kernel/profile.c and fs/proc/proc_misc.c and readprofile(1).
For example:
# echo > /proc/profile
...
# readprofile -m System.map-2.5.59 | sort -nr | head -2
510502 total 0.1534
508548 default_idle 10594.7500
The first column gives the number of timer ticks. The last column gives the
number of ticks divided by the size of the function.
The command readprofile -r is equivalent to echo > /proc/profile.
или kprobes
Reply to: