I'd think that what he's looking for is a bit what caliper cstack would provide.


So something like showing 'running' (consuming CPU) and 'blocked' (I/O, passive 
wait, etc...)...


Function Summary 
-------------------------------------------------------------------------------------------------------
% Total  Cumulat                          Sample         Sample                 
                   
   IP      % of              IP            Hits           Hits                  
                   
Samples    Total          Samples        Running        Blocked  Function       
                   File
-------------------------------------------------------------------------------------------------------
  42.11    42.11             1456           1456              0  
libc.so.1::__lseek_sys            
  38.09    80.19             1317            592            725  
libc.so.1::_read_sys              
   9.43    89.62              326            326              0  
libc.so.1::memset                 
   1.59    91.21               55             55              0  
libc.so.1::_write_sys             
Etc...

On the flat summary side


And something presented like this in the call graph part


Call Graph
--------------------------------------------------------------------
       --% Total Hits In / Under--    % Func Hits    
       Run +     Run       Block        Under Parent     Parents
Index  Block     Hits      Hits       In Func        Name     Index
       Hits      Only      Only         In Children      Children
--------------------------------------------------------------------
[1]    100.0      78.0      22.0        0.00         *ROOT* [1]
                                           79.47         dld.so::main_opd_entry 
[5]
                                           20.04         
*unknown_0x600000000e0a7608* [52]
                                            0.20         DDENV::main [4]
                                            0.09         DDENV::Bffo_BILLproc 
[25]
                                            0.06         DDENV::bffe_Root [46]
                                            0.03         
*unknown_0x6000000008f9c6e8* [364]
                                            0.03         DDENV::bfen_EXECproc 
[2]
                                            0.03         DDENV::F1_RootObject 
[63]
                                            0.03         *unknown_0x134* [451]
                                            0.03         
*unknown_0xc0000000000087a0* [456]
--------------------------------------------------------------------
                                           99.97         DDENV::main [4]
                                            0.03         *ROOT* [1]
[2]     99.8      77.8      22.0        0.00         DDENV::bfen_EXECproc [2]
                                          100.00         DDENV::bfen_INPUTproc 
[3]

Etc...




Sorry, I'm new to this list and have never used perf before but am planning to 
do so verysoon.
Did anyone answer his initial question "I would like to get a callgraph for the 
whole time a program runs. Is this possible with perf?"?


Thanks
++Cyrille


-----Original Message-----
From: [email protected] 
[mailto:[email protected]] On Behalf Of David Ahern
Sent: Friday, February 04, 2011 7:10 PM
To: Frederic Weisbecker; Christoph Bartoschek
Cc: [email protected]; Arnaldo Carvalho de Melo
Subject: Re: Profiling a program's runtime



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
--
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