On 02/04/11 10:47, Frederic Weisbecker wrote:

>> I want that not only the CPU time is counted that my task uses, but also the 
>> time my task waits.
> 
> The time your task waits, other tasks executes :-/  (including idle in the 
> scheme)
>  
>> For example, if my task waits for network packets in a read() then the time  
>> should be added to the read() function. Other profilers I know would not 
>> count the time when the process is blocked.

You can determine time blocked on read (and other system calls) by
acquiring all context switches:

    perf record -e cs -c 1 -a

>From there you'll want to generate a time history output. To use
unmodified perf code use the -D option to dump raw samples (perf report
-D). You can find the process of interest and the kernel timestamp
between schedule out events -- and the sched out event before your
process. Together you can piece together the time you blocked on read.

Alternatively, there are add-on patches which dump the timehistory in a
pretty print format:

http://www.mail-archive.com/[email protected]/msg00049.html
http://www.mail-archive.com/[email protected]/msg00047.html
http://www.mail-archive.com/[email protected]/msg00048.html


That output can be manipulated much easier to determine time on the
processor and time between schedule-in events.

Not the complete picture of what I think you are looking for -- but a
way to get the time blocked on syscall stats via perf.

David
--
To unsubscribe from this list: send the line "unsubscribe linux-perf-users" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to