papi_stop_counters(3) - Linux man page
Name
PAPI_stop_counters - PAPI High Level: stop counting hardware eventsand reset values to zero
Synopsis
C Interface#include <papi.h>int PAPI_stop_counters(long_long *values, int array_len);Fortran Interface
PAPIF_stop_counters(C_LONG_LONG(*) values, C_INT array_len, C_INT check)#include "fpapi.h"
Description
PAPI_stop_counters()This function stops the counters and copies the counts into the values array. The counters must have been started by a previous call to PAPI_start_counters(). After this function is called, the values are reset to zero.
Arguments
*values -- an array where to put the counter valuesarray_len -- the number of items in the *values array
Return Values
On success, this function returns PAPI_OK. On error, a non-zero error code is returned.Errors
- PAPI_EINVAL
- One or more of the arguments is invalid.
- PAPI_ENOTRUN
- The eventset is not started yet.
- PAPI_ENOEVST
- The eventset has not been added yet.
Examples
int Events[2] = { PAPI_TOT_CYC, PAPI_TOT_INS };
long_long values[2];
/* Start counting events */
if (PAPI_start_counters(Events, 2) != PAPI_OK)
handle_error(1);
your_slow_code();
/* Stop counting events */
if (PAPI_stop_counters(values, 2) != PAPI_OK)
handle_error(1);