PAPI_stop(3)

πŸ’… PAPI_stop πŸ’…

okay bestie, so this is PAPI_stop(3) from the PAPI manual β€” yeah, the performance API one β€” and it's literally the "stop counting now pls" function. let me walk you through it 🫢


✨ NAME ✨

PAPI_stop β€” stop counting hardware events in an event set. periodt. that's the whole name. πŸŽ€


🌸 SYNOPSIS 🌸

Detailed Description

okay so first things first, the C interface, no cap:

#include <papi.h>

int PAPI_stop( int EventSet, long long * values );

πŸ¦‹ Parameters

  • EventSet β€” an integer handle for a PAPI event set, the kind you get from PAPI_create_eventset. it's like the event set's little ID badge fr fr πŸͺͺ
  • values β€” an array to hold the counter values of the counting events. this is where the numbers go to live πŸ’–

⭐ Return values

  • PAPI_OK β€” slay, it worked ✨
  • PAPI_EINVAL β€” one or more of the arguments is invalid, like bestie what did you even pass 😭
  • PAPI_ESYS β€” a system or C library call failed inside PAPI, see the errno variable for the tea 🍡
  • PAPI_ENOEVST β€” the EventSet specified does not exist. it's giving "who is she" πŸ™ˆ
  • PAPI_ENOTRUN β€” the EventSet is currently not running. you can't stop what never started, iykyk πŸ’€

πŸ”₯ DESCRIPTION πŸ”₯

okay so PAPI_stop literally halts the counting of a previously defined event set, and the counter values contained in that EventSet are copied into the values array. it's the "ok we're done here" button and honestly it ate πŸ’…

highkey important: it assumes an initialized PAPI library and a properly added event set. don't come for me if you skip those steps 🫢

🧚 Example

here's the classic little demo, copied exactly, no cap:

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]);

like look at her go β€” create, add, start, run the poorly_tuned_function(), stop, print. iconic behavior from start to finish πŸ‘‘


πŸŽ€ See also πŸŽ€

  • PAPI_create_eventset
  • PAPI_start

go read those too, bestie, they're literally the prequel 🌈


πŸ’œ Author πŸ’œ

Generated automatically by Doxygen for PAPI from the source code. not me being literally generated by Doxygen 😭


and that's the whole vibe check, bestie πŸ’– this was PAPI_stop(3), from PAPI version 7.2.0.0, dated Wed Jun 25 2025 19:30:49 β€” no cap, that's the real timestamp πŸ•’βœ¨ iykyk 🫢πŸ’