Thanks for your reply. I had heard of PAPI before, but I never realized that it is at a higher level than libpfm4. Looking at the docs, it does sound quite a bit simpler than what I thought up. I guess I misunderstood the role of libpfm4.
Hello Paul,On 10/29/2010 04:20 PM, DRAM Ninjas wrote:
> Hello all,
> Up to this point I've been using task_smpl with libpfm4 to get
> process-wide performance counters, but I would like to be able to get
> counts for specific regions of interest. I was trying to search the
> archives and found a relevant feature for perfmon2, but seemingly
> nothing for libpfm4.
> Most of the things that I want to run these types of region of interest
> tests on are my own little toy programs, so I can easily augment them
> however I please. What I was thinking was just to setup a semaphore that
> will start out locked. The parent process in task_smpl will just
> sem_wait() right before the core loop, and the child will unlock the
> semaphore when it gets to the region of interest.
> I'm new to writing IPC code. I've written a small example that behaves
> as described above (where the parent doesn't continue executing until
> the child gets to a certain point), but I'm not sure if there are any
> pitfalls that I could be missing here. Does this sound like a feasible
> strategy? Is there some easier way to achieve what I am looking to do?
Have you thought about using a library like PAPI, called directly from
your code to do what you want? Using PAPI would be far simpler than
what you are attempting to accomplish using semaphores and other IPC
mechanisms, I think. PAPI provides a layer on top of libpfm +
perf_events (as well as other OS kernel APIs where available) which is
designed primarily for measuring events from the context of the
instrumented program rather than a remote monitoring program, such as
Another alternative would be to use libpfm+perf_events directly, instead
of using PAPI. However, PAPI's abstraction is easier to use.
PAPI info here:
Nokia and AT&T present the 2010 Calling All Innovators-North America contest
Create new apps & games for the Nokia N8 for consumers in U.S. and Canada
$10 million total in prizes - $4M cash, 500 devices, nearly $6M in marketing
Develop with Nokia Qt SDK, Web Runtime, or Java and Publish to Ovi Store
perfmon2-devel mailing list