NAME

PAPI_get_opt, PAPI_set_opt - get/set PAPI library or event set options
PAPIF_get_clockrate, PAPIF_get_domain, PAPIF_get_granularity, PAPIF_get_preload - Fortran implementation of some PAPI_get_opt options

CONTENTS

Synopsis
Description
Arguments
Return Values
Errors
Examples
Author
Bugs
See Also

SYNOPSIS

C Interface

#include <papi.h> 

int PAPI_get_opt(int option, PAPI_option_t *ptr); 

int PAPI_set_opt(int option, PAPI_option_t *ptr); 

Fortran Interface

#include fpapi.h 

PAPIF_get_clockrate(C_INT clockrate) 

PAPIF_get_domain(C_INT EventSet, C_INT domain, C_INT mode, C_INT check) 

PAPIF_get_granularity(C_INT EventSet, C_INT granularity, C_INT mode, C_INT check) 

PAPIF_get_preload(C_STRING preload, C_INT check) 

DESCRIPTION

PAPI_get_opt() and PAPI_set_opt() query or change the options of the PAPI library or a specific event set created by PAPI_create_eventset (3). The C interface for these functions passes a pointer to the PAPI_option_t structure. Not all options require or return information in this structure. The Fortran interface is a series of calls implementing various subsets of the C interface. Not all options in C are available in Fortran.

NOTE: / Some options, such as PAPI_SET_DOMAIN, are also available as separate entry points in both C and Fortran.

The reader is urged to see the example code in the PAPI distribution for usage of PAPI_get_opt. The file papi.h contains definitions for the structures unioned in the PAPI_option_t structure.

ARGUMENTS

option -- is an input parameter describing the course of action. Possible values are defined in papi.h and briefly described below. The Fortran calls are implementations of specific options.

ptr -- is a pointer to a structure that acts as both an input and output parameter. It is defined in papi.h and below.

EventSet -- input; a reference to an EventSetInfo structure

clockrate -- output; cycle time of this CPU in MHz; *may* be an estimate generated at init time with a quick timing routine

domain -- output; execution domain for which events are counted

granularity -- output; execution granularity for which events are counted

mode -- input; determines if domain or granularity are default or for the current event set

preload -- output; environment variable string for preloading libraries

Predefined nameExplanation
General information requests
PAPI_GET_CLOCKRATEReturn clockrate in MHz.
PAPI_GET_MAX_CPUSReturn number of CPUs.
PAPI_GET_MAX_HWCTRSReturn number of counters.
PAPI_GET_EXEINFOAddresses for text/data/bss.
PAPI_GET_HWINFOInfo. about hardware.
PAPI_GET_PRELOADGet ‘‘LD_PRELOAD’’ environment equivalent.
Defaults for the global library
PAPI_GET_DEFDOMReturn default counting domain for newly created event sets.
PAPI_SET_DEFDOMSet default counting domain.
PAPI_GET_DEFGRNReturn default counting granularity.
PAPI_SET_DEFGRNSet default counting granularity.
PAPI_GET_DEBUGGet the PAPI debug state. The available debug states are defined in The debug state is available in ptr->debug
PAPI_SET_DEBUGSet the PAPI debug state
Multiplexing control
PAPI_GET_MULTIPLEXGet options for multiplexing. Currently not implemented.
PAPI_SET_MULTIPLEXSet options for multiplexing
Manipulating individual event sets
PAPI_GET_DOMAINGet domain for a single event set. The event set is specified in ptr->domain.eventset
PAPI_SET_DOMAINSet the domain for a single event set.
PAPI_GET_GRANULGet granularity for a single event set. The event set is specified in ptr->granularity.eventset
PAPI_SET_GRANULSet the granularity for a single event set.

The option_t *ptr structure is defined in papi.h and looks something like the following example from the source tree. Users should use the definition in papi.h which is in synch with the library used.


typedef union {
  PAPI_preload_option_t preload;
  PAPI_debug_option_t debug;
  PAPI_inherit_option_t inherit;
  PAPI_granularity_option_t granularity;
  PAPI_granularity_option_t defgranularity;
  PAPI_domain_option_t domain;
  PAPI_domain_option_t defdomain;
  PAPI_multiplex_option_t multiplex;
  PAPI_hw_info_t *hw_info;
  PAPI_exe_info_t *exe_info; } PAPI_option_t;


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_ENOEVST
  The event set specified does not exist.
PAPI_EISRUN
  The event set is currently counting events.

EXAMPLES


int num, EventSet = PAPI_NULL;
PAPI_option_t options;

if ((num = PAPI_get_opt(PAPI_GET_MAX_HWCTRS,NULL)) <= 0) handle_error();

printf("This machine has %d counters.0,num);

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

/* Set the domain of this EventSet to counter user and kernel modes for this process */          memset(&options,0x0,sizeof(options));

options.domain.eventset = EventSet; options.domain.domain = PAPI_DOM_ALL; if (PAPI_set_opt(PAPI_SET_DOMAIN, &options) != PAPI_OK) handle_error();

AUTHOR

Philip J. Mucci <mucci@cs.utk.edu>

BUGS

There are no known bugs in these functions.

SEE ALSO

PAPI_create_eventset (3), PAPI_add_event (3), PAPI_start (3),
The PAPI Web Site: http://icl.cs.utk.edu/projects/papi


PAPI Function Reference PAPI_get_opt (3) December, 2001

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