Skip to contentSkip to conversation

Queries on using PERF tool

DISCUSSION Shahina Rabbani 3 participants 5 messages Nov 28, 2012 – Nov 29, 2012 3 messages not in the archive

lore
Share & tools
lore
#0 lore raw

Hi,

I am a new user of PERF tool. I have few questions to ask about the PERF tool. Please help me with the answers.

Q1. Is it possible to use PERF tool on a piece of code? Say i have a process P1 and the process has several functions F1, F2, F3. Is it possible to perform profilng only on F1 Function ??

Q2. Say i am using the PERF tool to counts some events depending on the clock value. If i change the clock value in between, then PERF tool can be able to understand the situation and generate the event counts according to the old and new clock values??

Please Help.

Thanks,
Shahina Rabbani

#1 lore raw

2012-11-28 오후 2:47, Shahina Rabbani 쓴 글:

Quoted 9 lines

Hi,

I am a new user of PERF tool. I have few questions to ask about the PERF tool. Please help me with the answers.

Q1. Is it possible to use PERF tool on a piece of code? Say i have a process P1 and the process has several functions F1, F2, F3. Is it possible to perform profilng only on F1 Function ??

As other profiling tools do, PERF also supports monitoring per function (per SYMBOL).

You can select the result related with the function you are interested in.

Quoted 4 lines

Q2. Say i am using the PERF tool to counts some events depending on the clock value. If i change the clock value in between, then PERF tool can be able to understand the situation and generate the event counts according to the old and new clock values??

As far as I know, there is no such thing to change the event type dynamically. Why don't you just monitor both of them simultaneously?

If you really want this job to be done in only this way,
you can make your own script which can change the event for Perf based on the clock value (also monitored by Perf).

Quoted 12 lines

Please Help.

Thanks,
Shahina Rabbani

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

#2 lore raw

Hi,

Quoted 11 lines · Chulmin Kim

2012-11-28 오후 2:47, Shahina Rabbani 쓴 글:

Quoted 9 lines

Hi,

I am a new user of PERF tool. I have few questions to ask about the PERF tool. Please help me with the answers.

Q1. Is it possible to use PERF tool on a piece of code? Say i have a process P1 and the process has several functions F1, F2, F3. Is it possible to perform profilng only on F1 Function ??

Quoted 4 lines

As other profiling tools do, PERF also supports monitoring per function (per SYMBOL).

You can select the result related with the function you are interested in.

It's not profiling the function only, it's just filtering the function in the whole result. You might want to use 'perf probe' command - on a recent kernel/perf tools support uprobe which is able to insert probe points dynamically to any user-level codes/functions.

Thanks,
Namhyung

A message that is not in the archive (sent off-list or not yet received): CA+wByoXeohgy4bhi3WN3was0-7RboXzWcTU1Kv0DrZ=b7ewR4Q@mail.gmail.com

#4 lore raw

Hi Shahina,

2012-11-29 (목), 13:45 +0530, Shahina Rabbani:

Quoted 7 lines

Hi Namhyung Kim ,

First of all Thanks for your mail.
I have some more doubts. Please help me.

Quoted 6 lines

Q1: when we are working with more than one CPU, there will be a shared L2 cache for all the CPUs and each CPU will have its own L1-cache
If i want to monitor a event and i am using L1-cahce and
L2-caches from CPU1 and the same time if CPU2 is also trying to monotora particular event and using L2-
cache. Then how the perf tool handles this situation.

On a recent kernel and Intel cpus, it supports offcore and/or uncore events for that purpose AFAIK. Please check your cpu manuals.

Quoted 11 lines

Q2. Can you please list what are the architechtures it is supporting at present.

Q3. Consider the case of Distributed systems, where the processors are connected through the network and say i am trying to transmit data over the TCP/IP stack. Is it
possible to monitor the data send at our end and data received
from the other end using the perf tool??

The perf tools work with pipe so that we might use nc/netcat for this. Only tested on a local machine:

<on terminal 1>

$ nc -l localhost 8282 | perf report -i -

<on terminal 2>

$ perf record -o - sleep 1 | nc localhost 8282
Quoted 7 lines

Q4. when using perf record. Say i have got the data in perf.data file. Say i am using this file to get some information and assume that system crashes and the perf.data file is
in inconsistent state. when u reboot the system after the crash,
is it posssible to get the perf.data file safely.???

I doubt you can use the file safely. There's no guarantee when system crashed.

Thanks,
Namhyung

Quoted 7 lines

Q5. Say i am counting some samples depending on the clock. and assume that i change the clock in between., Then the perf tool will be able to understand the situation and count the samples depending on the old and ne changed clocks or do we need to provide this information to perf tool.?? how to handle this situation??

A message that is not in the archive (sent off-list or not yet received): CAD15agZ1Q5RZ=LLnJ5d1t7WURL+C=S_KZ+Hn_NxukyYKaX12Vw@mail.gmail.com

A message that is not in the archive (sent off-list or not yet received): CA+wByoUyv8LGA_rZXV=xgLXQWG=s3jAXq9m_38tE9DjY94DC0w@mail.gmail.com

#7 lore raw

2012-11-28 오후 3:36, Shahina Rabbani 쓴 글:

Quoted 6 lines

Hi kim and Ritesh,

*kim:*
Thanks for ur reply. But i didnt understand how to profile a particular function of a process. Can u give the details with example please .

Have you used "perf-top"?
It will be a good reference to you.

This is my perf-top result when i execute SPEC CPU 2006.

PerfTop: 424 irqs/sec kernel: 5.2% exact: 0.0% [1000Hz
cycles], (all, 12 CPUs)
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

samples pcnt function DSO
_______ _____ _______________
__________________________________________________________________________________________________________________________________________

              105.00 12.7% quantum_toffoli 
/root/mnmate_3rd/cma_sched/spec2006/benchspec/CPU2006/462.libquantum/run/run_base_ref_amd64-m64-gcc41-nn.0004/libquantum_base.amd64-m64-gcc41-nn
               96.00 11.6% quantum_toffoli 
/root/mnmate_3rd/cma_sched/spec2006/benchspec/CPU2006/462.libquantum/run/run_base_ref_amd64-m64-gcc41-nn.0007/libquantum_base.amd64-m64-gcc41-nn
               89.00 10.8% quantum_toffoli 
/root/mnmate_3rd/cma_sched/spec2006/benchspec/CPU2006/462.libquantum/run/run_base_ref_amd64-m64-gcc41-nn.0005/libquantum_base.amd64-m64-gcc41-nn
               84.00 10.2% quantum_toffoli 
/root/mnmate_3rd/cma_sched/spec2006/benchspec/CPU2006/462.libquantum/run/run_base_ref_amd64-m64-gcc41-nn.0001/libquantum_base.amd64-m64-gcc41-nn
               62.00  7.5% quantum_toffoli 
/root/mnmate_3rd/cma_sched/spec2006/benchspec/CPU2006/462.libquantum/run/run_base_ref_amd64-m64-gcc41-nn.0003/libquantum_base.amd64-m64-gcc41-nn
               51.00  6.2% quantum_toffoli 
/root/mnmate_3rd/cma_sched/spec2006/benchspec/CPU2006/462.libquantum/run/run_base_ref_amd64-m64-gcc41-nn.0002/libquantum_base.amd64-m64-gcc41-nn
               45.00  5.4% quantum_toffoli 
/root/mnmate_3rd/cma_sched/spec2006/benchspec/CPU2006/462.libquantum/run/run_base_ref_amd64-m64-gcc41-nn.0008/libquantum_base.amd64-m64-gcc41-nn
               45.00  5.4% quantum_sigma_x 
/root/mnmate_3rd/cma_sched/spec2006/benchspec/CPU2006/462.libquantum/run/run_base_ref_amd64-m64-gcc41-nn.0005/libquantum_base.amd64-m64-gcc41-nn
               42.00  5.1% quantum_toffoli 
/root/mnmate_3rd/cma_sched/spec2006/benchspec/CPU2006/462.libquantum/run/run_base_ref_amd64-m64-gcc41-nn.0010/libquantum_base.amd64-m64-gcc41-nn
               37.00  4.5% quantum_sigma_x 
/root/mnmate_3rd/cma_sched/spec2006/benchspec/CPU2006/462.libquantum/run/run_base_ref_amd64-m64-gcc41-nn.0001/libquantum_base.amd64-m64-gcc41-nn
               28.00  3.4% quantum_cnot 
/root/mnmate_3rd/cma_sched/spec2006/benchspec/CPU2006/462.libquantum/run/run_base_ref_amd64-m64-gcc41-nn.0007/libquantum_base.amd64-m64-gcc41-nn
               26.00  3.1% quantum_cnot 
/root/mnmate_3rd/cma_sched/spec2006/benchspec/CPU2006/462.libquantum/run/run_base_ref_amd64-m64-gcc41-nn.0004/libquantum_base.amd64-m64-gcc41-nn
               20.00  2.4% quantum_sigma_x 
/root/mnmate_3rd/cma_sched/spec2006/benchspec/CPU2006/462.libquantum/run/run_base_ref_amd64-m64-gcc41-nn.0010/libquantum_base.amd64-m64-gcc41-nn
               16.00  1.9% quantum_sigma_x 
/root/mnmate_3rd/cma_sched/spec2006/benchspec/CPU2006/462.libquantum/run/run_base_ref_amd64-m64-gcc41-nn.0008/libquantum_base.amd64-m64-gcc41-nn
               11.00  1.3% quantum_sigma_x 
/root/mnmate_3rd/cma_sched/spec2006/benchspec/CPU2006/462.libquantum/run/run_base_ref_amd64-m64-gcc41-nn.0002/libquantum_base.amd64-m64-gcc41-nn
               10.00  1.2% format_decode   [kernel.kallsyms] 


                8.00  1.0% memcpy          /usr/bin/perf_3.0.0-12 


                7.00  0.8% vsnprintf       [kernel.kallsyms] 


                6.00  0.7% quantum_cnot 
/root/mnmate_3rd/cma_sched/spec2006/benchspec/CPU2006/462.libquantum/run/run_base_ref_amd64-m64-gcc41-nn.0002/libquantum_base.amd64-m64-gcc41-nn
                5.00  0.6% update_iter     [kernel.kallsyms]

Sorry for the broken format.

But, you can see there is the column called "function".

If your program is compiled with SYMBOLs (gcc, -g option), Perf reports the event counts corresponding to the symbols.

You can parse "perf-top" result directly.
Or,
there might be other ways if you look into the manual/help of Perf.

Quoted 71 lines

*Ritesh* :
@ present i did the experiments on ubuntu intel pc.
Actually these are the questions asked to me when i gave presentation on perf tool.
Even i have to check the statistics on the board.
I am in the process of setting up the board to work with the perf tool. I am facing some problems in the set up. Once i am done with it. then will check the perf tool statistics and share the results with u for sure.

Keep sharing the info if u got any.

Thanks.
Shahina

On Wed, Nov 28, 2012 at 11:45 AM, Ritesh Harjani <[email protected] <mailto:[email protected]>> wrote:

Hi Sahina,

I am also new to perf. Saw your mail on perf mailing list. Can you please tell me the statistics on what extent of profiling have you achieved through perf.

Reason for asking this is that I need to compare between perf and some other profiling tool.
If possible can you please share your results and also on what platform you are testing this?

Thank you
Ritesh

On Wed, Nov 28, 2012 at 11:17 AM, Shahina Rabbani <[email protected] <mailto:[email protected]>> wrote:

Hi,

I am a new user of PERF tool. I have few questions to ask about the PERF tool.
Please help me with the answers.

Q1. Is it possible to use PERF tool on a piece of code? Say i have a process P1
and the process has several functions F1, F2, F3. Is it possible to perform
profilng only on F1 Function ??

Q2. Say i am using the PERF tool to counts some events depending on the clock
value. If i change the clock value in between, then PERF tool can be able to
understand the situation and generate the event counts according to the old and
new clock values??

Please Help.

Thanks,
Shahina Rabbani

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