PAPI_event_name_to_code(3)

πŸŽ€ NAME πŸŽ€

okay so bestie, welcome to the PAPI_event_name_to_code(3) page from the PAPI manual. the NAME tea is: PAPI_event_name_to_code β€” Convert a name to a numeric hardware event code. it's giving main character energy, no cap. πŸ’…βœ¨

✨ SYNOPSIS ✨

the actual C interface is right below in Detailed Description, bestie β€” don't skip it, it's giving iconic. 🫢

🌈 DETAILED DESCRIPTION 🌈

πŸ’» C Interface: πŸ’»

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

okay so here's the tea: PAPI_event_name_to_code is used to translate an ASCII PAPI event name into an integer PAPI event code. literally that's the whole vibe. 🌸

🧾 Parameters 🧾

  • *EventCode β€” the numeric code for the event. πŸ’–
  • *EventName β€” a string containing the event name, as listed in PAPI_presets or discussed in PAPI_native. no cap, that's the exact source of the name. πŸ¦‹

🚦 Return values 🚦

  • PAPI_EINVAL β€” one or more of the arguments is invalid. πŸ™ˆ
  • PAPI_ENOTPRESET β€” the hardware event specified is not a valid PAPI preset. πŸ’€
  • PAPI_ENOINIT β€” the PAPI library has not been initialized. 😭
  • PAPI_ENOEVNT β€” the hardware event is not available on the underlying hardware. 🫠

🎬 Examples: 🎬

bestie, here's the iconic example, copied exactly so you can trust it:

int EventCode, EventSet = PAPI_NULL;
// Convert to integer
if ( PAPI_event_name_to_code( "PAPI_TOT_INS", &EventCode ) != PAPI_OK )
handle_error( 1 );
// Create the EventSet
if ( PAPI_create_eventset( &EventSet ) != PAPI_OK )
handle_error( 1 );
// Add Total Instructions Executed to our EventSet
if ( PAPI_add_event( EventSet, EventCode ) != PAPI_OK )
handle_error( 1 );

πŸ‘€ See also πŸ‘€

  • PAPI_event_code_to_name
  • PAPI_remove_event
  • PAPI_get_event_info
  • PAPI_enum_event
  • PAPI_add_event
  • PAPI_add_named_event
  • PAPI_presets
  • PAPI_native

✍️ AUTHOR ✍️

not a human author, bestie β€” the author line says: Generated automatically by Doxygen for PAPI from the source code. πŸ’–

🏷️ VERSION 🏷️

slay, this page is stamped Version 7.2.0.0 and dated Wed Jun 25 2025 19:30:48 β€” and it's the PAPI_event_name_to_code(3) manual page from PAPI. bye bestie, go convert those event names. πŸ’…βœ¨πŸŽ€