NAME

PAPI_read_counters, PAPI_accum_counters - PAPI High Level: read counting hardware events

CONTENTS

Synopsis
Description
Arguments
Return Values
Errors
Examples
Authors
Bugs
See Also

SYNOPSIS

C Interface

#include <papi.h> 

int PAPI_read_counters(long_long *values, int array_len); 

int PAPI_accum_counters(long_long *values, int array_len); 

Fortran Interface

#include fpapi.h 

PAPIF_read_counters(C_LONG_LONG(*) values, C_INT array_len, C_INT check) 

PAPIF_accum_counters(C_LONG_LONG(*) values, C_INT array_len, C_INT check) 

DESCRIPTION

PAPI_read_counters() copies the event counters into the array values .
The counters are reset and left running after the call.

PAPI_accum_counters() adds the event counters into the array values .
The counters are reset and left running after the call.

ARGUMENTS

*values -- an array to hold the counter values of the counting events

array_len -- the number of items in the *events array

RETURN VALUES

On success, these functions return PAPI_OK.
On error, a non-zero error code is returned.

ERRORS

PAPI_EINVAL
  One or more of the arguments is invalid.
PAPI_ESYS
  A system or C library call failed inside PAPI, see the errno variable.

EXAMPLES


  int Events[2] = { PAPI_TOT_CYC, PAPI_TOT_INS };
  long_long values[2];
  int num_hwcntrs = 0;
        
  if ((num_hwcntrs = PAPI_num_counters()) != PAPI_OK)
    handle_error(1);

if (num_hwcntrs > 2) num_hwcntrs = 2;

/* Start counting events */

if (PAPI_start_counters(Events, num_hwcntrs) != PAPI_OK) handle_error(1);

your_slow_code();

/* Start counting events */

if (PAPI_read_counters(values, num_hwcntrs) != PAPI_OK) handle_error(1);

AUTHORS

The PAPI Team. See them at the PAPI Web Site: http://icl.cs.utk.edu/projects/papi

BUGS

These functions have no known bugs.

SEE ALSO

PAPI_num_counters (3), PAPI_start_counters (3), PAPI_stop_counters (3)


PAPI Programmer’s Reference PAPI_read_counters (3) November, 2003

  Innovative Computing Laboratory
2001 R&D Winner  
Contact PAPI: papi@cs.utk.edu Computer Science Department
  University of Tennessee