PAPI_create_eventset(3)

πŸ’– PAPI_create_eventset β€” the "make a fresh EventSet" era πŸ’–

So this is a page out of PAPI's manual (that's the Performance API, bestie, not the guy from your chem class), section 3, and it's all about one little function that gets the whole party started. Let's go.


✨ NAME ✨

PAPI_create_eventset β€” literally creates a brand-new, completely empty PAPI EventSet. A blank canvas. An empty group chat. πŸŽ€


🌸 SYNOPSIS 🌸

C Interface:

#include <papi.h>
PAPI_create_eventset( int * EventSet );

πŸ¦‹ DESCRIPTION πŸ¦‹

Okay so PAPI_create_eventset makes a new EventSet, and the pointer to it lives in EventSet. But β€” and this is the part everyone fumbles β€” EventSet must already be initialized to PAPI_NULL before you call this routine. No exceptions, no vibes-based workarounds. 🫢

Once you've got your shiny new EventSet, you can start adding hardware events to it by calling PAPI_add_event or one of its sibling routines. That's when the fun starts. ✨

Note πŸ‘‘ PAPI-C uses a late binding model to bind EventSets to components. When an EventSet is first created, it is not bound to a component. The consequence (and yes this is a real one): some API calls that modify EventSet options will fail. 😭 You can bind an EventSet to a component in two ways: - explicitly, by calling PAPI_assign_eventset_component - implicitly, by calling PAPI_add_event or similar routines

πŸ’… Parameters

  • *EventSet β€” the address of an integer location where the new EventSet handle gets stored. Hand it a pointer, get a handle. Iconic behavior tbh.

🧚 Exceptions

  • PAPI_EINVAL β€” the argument handle has not been initialized to PAPI_NULL, or the argument is a NULL pointer. Basically: you didn't follow step one, bestie. πŸ™ˆ
  • PAPI_ENOMEM β€” insufficient memory to complete the operation. Not your fault, the machine's just broke. πŸ’€

🌈 Examples:

int EventSet = PAPI_NULL;
if ( PAPI_create_eventset( &EventSet ) != PAPI_OK )
handle_error( 1 );
// Add Total Instructions Executed to our EventSet
if ( PAPI_add_event( EventSet, PAPI_TOT_INS)  != PAPI_OK )
handle_error( 1 );

See how it starts at PAPI_NULL first? That's the whole trick. Slay. πŸ”₯


πŸ“ See also

  • PAPI_add_event
  • PAPI_assign_eventset_component
  • PAPI_destroy_eventset
  • PAPI_cleanup_eventset

⭐ Author ⭐

Generated automatically by Doxygen for PAPI from the source code. (So nobody hand-wrote this one, but we're giving it main character energy anyway. πŸ‘‘)


Okay that's the whole page, no cap β€” every flag, value, error, and example is in there. Now go initialize your EventSet to PAPI_NULL and live your truth. πŸ’œ

Signing off with love from Version 7.2.0.0, dated Wed Jun 25 2025 19:30:48 β€” the PAPI_create_eventset(3) girlies ate and left no crumbs. πŸŒΈπŸ’–