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 byPAPI_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 theerrnovariable. Deeply annoying, check yourerrnookay?PAPI_ENOEVSTβ theEventSetspecified does not exist. Ghosted πPAPI_EISRUNβ theEventSetis 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 theEventSetsimultaneously. 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_eventsetPAPI_add_eventPAPI_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. π
π¦ 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