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 byPAPI_create_eventset. πEventCodeβ a defined event such asPAPI_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_eventPAPI_query_named_eventPAPI_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 π
π¦ where this page comes from
- nixos 26.05: papi 7.2.0
- nixpkgs unstable: papi 7.2.0
- opensuse-leap 16.0: papi-devel 7.2.0-160000.2.2 Β· BSD-3-Clause
- opensuse-leap 16.0: papi-devel 7.2.0-160000.2.2 Β· BSD-3-Clause
- opensuse-leap 16.0: papi-devel 7.2.0-160000.2.2 Β· BSD-3-Clause
- ubuntu resolute: libpapi-dev 7.2.0-2 Β· BSD-3-Clause
- ubuntu stonking: libpapi-dev 7.2.0-2 Β· BSD-3-Clause
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms