NAME

PAPI_num_events - return the number of events in an event set

CONTENTS

Synopsis
Description
Arguments
Return Values
Errors
Examples
Authors
Bugs
See Also

SYNOPSIS

C Interface

#include <papi.h> 

int PAPI_num_events(int EventSet); 

Fortran Interface

#include fpapi.h 

PAPIF_num_events(C_INT EventSet, C_INT count) 

DESCRIPTION

PAPI_num_events() returns the number of preset events contained in an event set.

ARGUMENTS

EventSet -- an integer handle for a PAPI event set as created by PAPI_create_eventset (3)

*count -- On output the variable contains the number of events in the event set.

RETURN VALUES

On success, this function returns the positive number of events in the event set. On error, a non-zero error code is returned.

ERRORS

PAPI_EINVAL
  The event count is zero; only if code is compiled with debug enabled.
PAPI_ENOEVST
  The EventSet specified does not exist.

EXAMPLES


  int EventCode, EventSet = PAPI_NULL;
        
  /* Create an EventSet */

if (PAPI_create_eventset(&EventSet) != PAPI_OK) handle_error(1);

/* Convert an event name to an event code */

if (PAPI_event_name_to_code("PAPI_TOT_INS",&EventCode) != PAPI_OK) handle_error(1);

/* Query if Total Instructions Executed exists */

if (PAPI_query_event(EventCode) != PAPI_OK) handle_error(1);

/* Add Total Instructions Executed to our EventSet */

if (PAPI_add_event(EventSet, EventCode) != PAPI_OK) handle_error(1);

/* Convert a second event name to an event code */

if (PAPI_event_name_to_code("PAPI_L1_LDM",&EventCode) != PAPI_OK) handle_error(1);

/* Query if L1 Load Misses exists */

if (PAPI_query_event(EventCode) != PAPI_OK) handle_error(1);

/* Add L1 Load Misses to our EventSet */

if (PAPI_add_event(EventSet, EventCode) != PAPI_OK) handle_error(1);

/* Count the events in our EventSet */

if (PAPI_num_events(EventSet) != 2) handle_error(1);

AUTHORS

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

BUGS

This function has no known bugs.

SEE ALSO

PAPI_event_name_to_code (3), PAPI_query_event (3), PAPI_add_event (3)


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

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