PAPIC:PAPI set domain.3
From PAPIDocs
(Redirected from PAPIC:PAPI set cmp domain.3)
Jump to: navigation, search


  • PAPI_set_domain - set the default counting domain for new event sets bound to the cpu component
  • PAPI_set_cmp_domain - set the default counting domain for new event sets bound to the specified component


C Interface

#include <papi.h>
int PAPI_set_domain(int  domain );
int PAPI_set_cmp_domain(int  domain, int  cidx );

Fortran Interface

#include fpapi.h
PAPIF_set_domain(C_INT  domain,  C_INT  check )
PAPIF_set_event_domain(C_INT  EventSet,  C_INT  domain,  C_INT  check )


PAPI_set_domain sets the default counting domain for all new event sets created by PAPI_create_eventset (3) in all threads. This call implicitly sets the domain for the cpu component (component 0) and is included to preserve backward compatibility.

PAPI_set_cmp_domain sets the default counting domain for all new event sets in all threads, and requires an explicit component argument. Event sets that are already in existence are not affected. To change the domain of an existing event set, please see the PAPI_set_opt (3) man page.The reader should note that the domain of an event set affects only the mode in which the counter continues to run. Counts are still aggregated for the current process, and not for any other processes in the system. Thus when requesting PAPI_DOM_KERNEL , the user is asking for events that occur on behalf of the process, inside the kernel.


cidx -- An integer identifier for a component. By convention, component 0 is always the cpu component. domain -- one of the following constants as defined in the papi.h header file:

PAPI_DOM_USER User context counted
PAPI_DOM_KERNEL Kernel/OS context counted
PAPI_DOM_OTHER Exception/transient mode counted
PAPI_DOM_SUPERVISOR Supervisor/hypervisor context counted
PAPI_DOM_ALL All above contexts counted
PAPI_DOM_MIN The smallest available context
PAPI_DOM_MAX The largest available context


PAPI_EINVAL One or more of the arguments is invalid.

PAPI_ENOEVST The event set specified does not exist.

PAPI_ENOCMP The argument cidx is not a valid component.

PAPI_EISRUN The event set is currently counting events.


int retval;
/* Initialize the library */
retval = PAPI_library_init(PAPI_VER_CURRENT);
if (retval > 0 && retval != PAPI_VER_CURRENT) {
  fprintf(stderr,"PAPI library version mismatch!\n");
if (retval < 0)
/* Set the default domain for the cpu component */
if ((retval = PAPI_set_cmp_domain(PAPI_DOM_KERNEL,0)) != PAPI_OK)
if ((retval = PAPI_create_eventset(&EventSet)) != PAPI_OK)


This function has no known bugs.

See Also

PAPI_set_granularity(3), PAPI_set_opt(3), PAPI_get_opt(3)