PAPI_set_domain(3)

πŸ¦‹ PAPI_set_domain(3) β€” PAPI manual, bestie πŸ¦‹

✨ NAME ✨

PAPI_set_domain β€” sets the default counting domain for new event sets bound to the cpu component. That's the assignment, and it understood it. πŸ’…

🌸 SYNOPSIS 🌸

πŸ’« Detailed Description πŸ’«

🧚 C Prototype:

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

πŸ“ Parameters

domain is one of the following constants, as defined in the papi.h header file β€” no cap:

  • 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 πŸ”₯

πŸ’€ Return values

  • PAPI_OK β€” a return value, no extra description attached in the original. ✨
  • PAPI_EINVAL β€” One or more of the arguments is invalid. 😭

Okay so here's the tea: PAPI_set_domain sets the default counting domain for all new event sets created by PAPI_create_eventset in all threads. This call implicitly sets the domain for the cpu component (component 0), and it's included to preserve backward compatibility. Lowkey legacy, highkey still important. 🫢

πŸ’– Example:

int ret;

// Initialize the library
ret = PAPI_library_init(PAPI_VER_CURRENT);
if (ret > 0 && ret != PAPI_VER_CURRENT) {
  fprintf(stderr,"PAPI library version mismatch!\n");
  exit(1);
}
if (ret < 0) handle_error(ret);

// Set the default domain for the cpu component
ret = PAPI_set_domain(PAPI_DOM_KERNEL);
if (ret != PAPI_OK) handle_error(ret);
ret = PAPI_create_eventset(&EventSet);
if (ret != PAPI_OK) handle_error(ret);

πŸ”— SEE ALSO πŸ”—

  • PAPI_set_cmp_domain
  • PAPI_set_granularity
  • PAPI_set_opt
  • PAPI_get_opt

πŸ‘‘ AUTHOR πŸ‘‘

The author line says it was generated automatically by Doxygen for PAPI from the source code. So yeah, Doxygen ate that one. πŸ’…


Cute sign-off: this page is from PAPI version 7.2.0.0, dated Wed Jun 25 2025 19:30:49, and the footer also says PAPI_set_domain(3). Byeee, bestie β€” go set that domain! πŸ’–βœ¨πŸŽ€