Re: Performance Stats: Kernel patch

From: Eric Dumazet
Date: Wed Apr 11 2007 - 15:23:53 EST


Maxim Uvarov a écrit :
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 was not speaking about locks.


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.


What I meant is : You falsely speak of 'PROCESS performance statistics'.

Your implementation only cares about threads, not processes.
There is a slight difference, that getrusage() can do.

So if you do "cat /proc/PID/status", you'll get counters not for the PROCESS, only the main thread of the process.

If you want an analogy, imagine a "ps aux" that doesnt show the cpu time of all threads of a process, but only the cpu time of the main thread. Quite meaningless isnt it ?

So either :

1) You change all your description to mention 'thread' instead of 'process'.

2) You change your implementation to match your claim.

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/