Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [linuxtools-dev] [TMF] Advanced statistics view


> The structure could look like this :
>
> Process #1 : 25% total
>     -> CPU0 : 20%
>     -> CPU1 : 5%

I suppose that you first need to compute the CPU usage per process while building the state history, summing it up each time it is scheduled out. The usage up to t0 then becomes the sum at t0 (all scheduled in intervals summed up upon their end) + the elapsed time since the last schedule in, if the process is still running. Thereafter, you can compute the usage between t0 and t1 as the difference between the usage up to each of t0 and t1. Having the usage for an interval, it becomes easy to compute the %.

The question then becomes what is the 100% reference? Is it one CPU or the sum of all CPUs. For a single thread, the maximum you could do is use one CPU, it may then be interesting to know that usage is 100% of the elapsed time. For a multi-threaded process, having more CPU time than elapsed time may be "surprising" to the user (> 100%), in which case dividing by the total available CPU time may be more appropriate.

The "top" command has both modes (names IRIX and Solaris modes) dividing or not the CPU time by the number of processors. Top also has the ability to show the CPU time for a process and its children.


Back to the top