PAPI_start(3)

πŸ’… PAPI_start β€” start counting hardware events in an event set πŸ’…

Hey bestie, welcome to the PAPI manual, page PAPI_start(3). This is the moment your event set actually, like, wakes up and starts doing the thing. Let's go ✨


πŸŽ€ NAME πŸŽ€

PAPI_start β€” start counting hardware events in an event set. That's it, that's the whole vibe check. πŸ’–


✨ SYNOPSIS ✨

🌸 C Interface 🌸

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

πŸ¦‹ Parameters πŸ¦‹

  • EventSet β€” an integer handle for a PAPI event set as created by PAPI_create_eventset. Basically it's the little name tag your event set got at check-in 🎫

🫢 Return values 🫢

Okay so these are the possible receipts you can get back:

  • PAPI_OK β€” the good one. The slay. Everything worked πŸ‘‘
  • PAPI_EINVAL β€” one or more of the arguments is invalid. Not it 😭
  • PAPI_ESYS β€” a system or C library call failed inside PAPI, see the errno variable. Deeply annoying, check your errno okay?
  • PAPI_ENOEVST β€” the EventSet specified does not exist. Ghosted πŸ’€
  • PAPI_EISRUN β€” the EventSet is currently counting events. She's already busy, give her a minute πŸƒβ€β™€οΈ
  • PAPI_ECNFLCT β€” the underlying counter hardware can not count this event and other events in the EventSet simultaneously. Unfortunate lineup, ngl πŸ€·β€β™€οΈ
  • PAPI_ENOEVNT β€” the PAPI preset is not available on the underlying hardware. Not this hardware, bestie πŸ™ˆ

🌈 DESCRIPTION 🌈

PAPI_start starts counting all of the hardware events contained in the previously defined EventSet. Iconic. ✨

And here's the cute little detail: all counters are implicitly set to zero before counting. Fresh start energy, periodt. 🧼

It assumes an initialized PAPI library and a properly added event set β€” so if you skipped those steps, that's on you babe 🫢


🌟 EXAMPLE 🌟

Bestie, here's the whole flow start to finish:

int EventSet = PAPI_NULL;
long long values[2];
int ret;

ret = PAPI_create_eventset(&EventSet);
if (ret != PAPI_OK) handle_error(ret);

// Add Total Instructions Executed to our EventSet
ret = PAPI_add_event(EventSet, PAPI_TOT_INS);
if (ret != PAPI_OK) handle_error(ret);

// Start counting
ret = PAPI_start(EventSet);
if (ret != PAPI_OK) handle_error(ret);
poorly_tuned_function();
ret = PAPI_stop(EventSet, values);
if (ret != PAPI_OK) handle_error(ret);
printf("%lld\n",values[0]);

Look at that little poorly_tuned_function() getting its moment of exposure πŸ’€ she is literally being measured.


πŸ‘€ SEE ALSO πŸ‘€

Go read these too, they're the friend group πŸ‘‘:

  • PAPI_create_eventset
  • PAPI_add_event
  • PAPI_stop

πŸ“ AUTHOR πŸ“

Generated automatically by Doxygen for PAPI from the source code. Honestly? Robot energy, but we respect it 🧚


πŸ’œ Sign-off πŸ’œ

That's the page, bestie! This was Version 7.2.0.0, dated Wed Jun 25 2025 19:30:49 β€” scribbled down for PAPI_start(3) and now delivered to you with full glam. Now go start those counters πŸ’…πŸ”₯

Count responsibly, check your return values, and never let a PAPI_EISRUN catch you off guard. πŸŽ€