Re: Measuring Events within Functions

William Cohen <[email protected]>
Newsgroups gmane.linux.oprofile
Message-ID <[email protected]>
On 01/06/2016 09:43 PM, Aidan Macdonald wrote:
> Hi,
> 
> I would like to profile my code similar to "ocount" in that I measure the amount of events (ie cache misses) that occur, but specify that they happen at or around certain lines of code.
> 
> Is it possible to count the number of cache misses within a single function? single line of code? a single loop of code? etc?
> 
> As a side note, when I use ocount on OpenMP compiled code, are the event counts for a single thread, or over all.
> 
> Thank you,
> 
> Aidan Macdonald
> 805 418 0174
> [email protected] <mailto:[email protected]>
> [email protected] <mailto:[email protected]>

oprofile doesn't really have a mode to do that measurement over a specific section of code.  You might look at papi (http://icl.cs.utk.edu/papi/) it does have the ability to record measurements over specific intervals. However there is overhead for reading the perf data data.  A quick run of papi_cost on a ivy bridge based machine show this:


$ papi_cost 
Cost of execution for PAPI start/stop, read and accum.
This test takes a while. Please be patient...

Performing loop latency test...

Total cost for loop latency over 1000000 iterations
min cycles   : 24
max cycles   : 21415
mean cycles  : 36.106081
std deviation: 41.818344
 
Performing start/stop test...

Total cost for PAPI_start/stop (2 counters) over 1000000 iterations
min cycles   : 8582
max cycles   : 63785
mean cycles  : 9319.719951
std deviation: 2282.754662
 
Performing read test...

Total cost for PAPI_read (2 counters) over 1000000 iterations
min cycles   : 2544
max cycles   : 42329
mean cycles  : 2754.171192
std deviation: 1216.760013
 
Performing read with timestamp test...

Total cost for PAPI_read_ts (2 counters) over 1000000 iterations
min cycles   : 2548
max cycles   : 42466
mean cycles  : 2722.008745
std deviation: 1190.999095
 
Performing accum test...

Total cost for PAPI_accum (2 counters) over 1000000 iterations
min cycles   : 3698
max cycles   : 39268
mean cycles  : 3980.163599
std deviation: 1379.389730
 
Performing reset test...

Total cost for PAPI_reset (2 counters) over 1000000 iterations
min cycles   : 1042
max cycles   : 38219
mean cycles  : 1132.070697
std deviation: 717.207953
 
Performing DERIVED_POSTFIX PAPI_read(3 counters)  test...
Total cost for PAPI_read (1 derived_postfix counter) over 1000000 iterations
min cycles   : 3090
max cycles   : 39994
mean cycles  : 3315.180021
std deviation: 1278.000295
 cost.c                                       FAILED
Line # 387
Error in PAPI_add_event: Invalid argument

-Will


------------------------------------------------------------------------------
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.