[Ptools-perfapi] Seeking Some clarifications regarding C API

Vince Weaver vweaver1 at eecs.utk.edu
Thu Aug 4 09:01:12 EDT 2011

On Thu, 4 Aug 2011, Saurabh Kumar wrote:

> Do PAPI_start() and PAPI_stop() functions serialize the instructions to
> ensure that they count all the instructions between the two calls?
> I was thinking of using "cpuid" assembly instruction to serialize the
> execution in case something similar has not been implemented internally by
> PAPI to handle this issue. Does papi itself ensure serialization?

the "wrmsr" that the kernel actually uses to start/stop the counters 
should be serializing as far as I can tell.

In general for events that we can "know" the proper value for, the 
hardware counters return values within +/- 1 of expected.

This is probably lost in the noise when using PAPI as you'll get an extra 
few hundred instructions from the PAPI librbary recorded when issusing a 


More information about the Ptools-perfapi mailing list