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 fromPAPI_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 theerrnovariable for the tea π΅PAPI_ENOEVSTβ theEventSetspecified does not exist. it's giving "who is she" πPAPI_ENOTRUNβ theEventSetis 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_eventsetPAPI_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 π«Άπ
π¦ 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