PAPI_add_named_event(3)

πŸ’… PAPI_add_named_event(3) πŸ’…

okay so welcome to the PAPI manual, section 3, bestie β€” this is the whole vibe for PAPI_add_named_event, and it's literally about adding a PAPI preset or native hardware event, by name, to an EventSet. 🫢


πŸ’– NAME πŸ’–

PAPI_add_named_event β€” add a PAPI preset or native hardware event by name to an EventSet. no cap, that's the whole mission. ✨

✨ SYNOPSIS ✨

πŸŽ€ Detailed Description πŸŽ€

C Interface:

#include <papi.h>
int PAPI_add_named_event( int EventSet, const char *EventName );

PAPI_add_named_event adds one event to a PAPI EventSet. Just one. One event. That's the assignment. πŸ’…

A hardware event can be either a PAPI preset or a native hardware event code β€” both are valid, fr fr.

For a list of PAPI preset events, see PAPI_presets or run the avail test case in the PAPI distribution. PAPI presets can be passed to PAPI_query_event to see if they exist on the underlying architecture. For a list of native events available on the current platform, run the papi_native_avail utility in the PAPI distribution. iconic. 🌈

🌸 Parameters 🌸

  • EventSet β€” an integer handle for a PAPI Event Set as created by PAPI_create_eventset. πŸŽ€
  • EventCode β€” a defined event such as PAPI_TOT_INS. ⭐
yes bestie, the page really does say EventCode here β€” I'm not changing the lore, I'm just delivering it exactly. πŸ’€

πŸ’… Return values πŸ’…

  • Positive-Integer β€” the number of consecutive elements that succeeded before the error. πŸ‘‘
  • PAPI_EINVAL β€” one or more of the arguments is invalid.
  • PAPI_ENOINIT β€” the PAPI library has not been initialized.
  • PAPI_ENOMEM β€” insufficient memory to complete the operation.
  • PAPI_ENOEVST β€” the event set specified does not exist.
  • PAPI_EISRUN β€” the event set is currently counting events.
  • PAPI_ECNFLCT β€” the underlying counter hardware can not count this event and other events in the event set simultaneously.
  • PAPI_ENOEVNT β€” the PAPI preset is not available on the underlying hardware.
  • PAPI_EBUG β€” internal error, please send mail to the developers. 😭
  • PAPI_EMULPASS β€” event exists, but cannot be counted due to multiple passes required by hardware.

πŸ¦‹ Examples πŸ¦‹

           char EventName = "PAPI_TOT_INS";
           int EventSet = PAPI_NULL;
           unsigned int native = 0x0;
           if ( PAPI_create_eventset( &EventSet ) != PAPI_OK )
           handle_error( 1 );
           // Add Total Instructions Executed to our EventSet
           if ( PAPI_add_named_event( EventSet, EventName ) != PAPI_OK )
           handle_error( 1 );
           // Add native event PM_CYC to EventSet
           if ( PAPI_add_named_event( EventSet, "PM_CYC" ) != PAPI_OK )
           handle_error( 1 );

πŸŽ€ See also πŸŽ€

  • PAPI_add_event
  • PAPI_query_named_event
  • PAPI_remove_named_event

πŸ‘‘ Author πŸ‘‘

Generated automatically by Doxygen for PAPI from the source code. honestly? slay. ✨


πŸ’– cute little sign-off: this page is from PAPI version 7.2.0.0, dated Wed Jun 25 2025 19:30:48, and it's the PAPI_add_named_event(3) page. mwah πŸ’‹