Eric Dumazet wrote:
>Please check kernel/sys.c:k_getrusage() to see how getrusage() has to sum *lot* of individual fields to get precise process numbers (even counting stats for dead threads)
Thanks for helping me and for this link. But it is not enough clear for me what do you mean at this time. Inside of patch I am using 2 default counters
task_struct->nivcsw and task_struct->nvcsw. And also one new syscall counter. And there is only one way to increment this counter, it is from entry.S.
If you are speaking about locks, in my point of view, they are not needed in this code. Because increment syscall counter is atomic for X86 (just one assembly instruction) and in case with PPC (3 instructions) there 1) nothing wrong will not happen in any case 2) only own thread can increase it's syscall counter. So here should be not any race conditions.
I've tested this patch on x86,x86_64,and ppc_32. And I should work now with ppc_64 (I didn't check).
And also updated description.
Best regards,
Maxim Uvarov.
------------------------------------------------------------------------
Patch adds Process Performance Statistics.
It make available to the user the following thread performance statistics:
* Involuntary Context Switches (task_struct->nivcsw)
* Voluntary Context Switches (task_struct->nvcsw)
* Number of system calls (added new counter thread_info->sysc_cnt)
Statistics information is available from
/proc/PID/status
This data is useful for detecting hyperactivity patterns between processes.