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 callingPAPI_assign_eventset_component- implicitly, by callingPAPI_add_eventor 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 argumenthandlehas not been initialized toPAPI_NULL, or the argument is aNULLpointer. 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_eventPAPI_assign_eventset_componentPAPI_destroy_eventsetPAPI_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. πΈπ
π¦ 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