PAPI_query_event(3)

πŸŽ€ NAME πŸŽ€

PAPI_query_event β€” the lil' vibe-check function that tells you whether a PAPI event actually exists. πŸ’…


✨ SYNOPSIS ✨

Detailed Description

C Interface:

#include <papi.h>
int PAPI_query_event(int EventCode);

Okay so bestie, here's the tea β˜•: PAPI_query_event() slides into the PAPI library's DMs and asks whether a PAPI Preset event can actually be counted on this architecture. If the event CAN be counted, the function returns PAPI_OK β€” slay, we're so back. πŸ’– If the event CANNOT be counted, you get an error code back instead. 😭 This function can also be used to check the syntax of native and user events, which is lowkey iconic of it. πŸ¦‹

Parameters

  • EventCode β€” a defined event, like PAPI_TOT_INS. Periodt. πŸ‘‘

Return values

  • PAPI_EINVAL β€” one or more of the arguments is invalid. πŸ™ˆ not the invalid args!!
  • PAPI_ENOEVNT β€” the PAPI preset is not available on the underlying hardware. πŸ’€ genuinely giving "it's just not here" energy.

Examples

int retval;
// Initialize the library
retval = PAPI_library_init(PAPI_VER_CURRENT);
if (retval != PAPI_VER_CURRENT) {
  fprintf(stderr,\"PAPI library init error!\\n\");
  exit(1);
}
if (PAPI_query_event(PAPI_TOT_INS) != PAPI_OK) {
  fprintf(stderr,\"No instruction counter? How lame.\\n\");
  exit(1);
}
fr fr, that error message speaks for all of us. "No instruction counter? How lame." is main character energy and honestly iconic. πŸ”₯

See also

  • PAPI_remove_event
  • PAPI_remove_events
  • PAPI_presets
  • PAPI_native

🌸 Author 🌸

Generated automatically by Doxygen for PAPI from the source code. (Not me writing this by hand, bestie β€” the robots did it, and they ate. πŸ€–βœ¨)


Version 7.2.0.0 Β· Wed Jun 25 2025 19:30:48 β€” mwah, that's the whole page, drink some water and go count some events πŸ«ΆπŸ’œπŸ§š