PAPI_detach(3)
okay so welcome to the PAPI manualβs PAPI_detach(3) page, bestie π this one is short but iconic, and we are keeping every single detail, no cap.
π NAME π
PAPI_detach β detach a PAPI event set from a previously specified thread id and restore it to the executing thread. literally thatβs the whole vibe β¨
πΈ SYNOPSIS πΈ
the C interface is sitting right below in the Detailed Description section, bestie π
β¨ Detailed Description β¨
π» C Interface: π»
#include <papi.h>
int PAPI_detach( int EventSet, unsigned long tid );
okay so PAPI_detach is a wrapper function that calls PAPI_set_opt to allow PAPI to monitor performance counts on a thread other than the one currently executing π this is sometimes referred to as third party monitoring. PAPI_attach connects the specified EventSet to the specified thread; PAPI_detach breaks that connection and restores the EventSet to the original executing thread. periodt π
π Parameters π
EventSetβ an integer handle for a PAPIEventSetas created byPAPI_create_eventsetπ«Άtidβ a thread id as obtained from, for example,PAPI_list_threadsorPAPI_thread_idπΈ
π Return values π
PAPI_ECMPβ this feature is unsupported on this component πPAPI_EINVALβ one or more of the arguments is invalid πPAPI_ENOEVSTβ the event set specified does not exist πPAPI_EISRUNβ the event set is currently counting events π₯
π Examples: π
hereβs the example, copied exactly because we do not mess with code, ever π§
int EventSet = PAPI_NULL;
unsigned long pid;
pid = fork( );
if ( pid <= 0 )
exit( 1 );
if ( PAPI_create_eventset( &EventSet ) != PAPI_OK )
exit( 1 );
// Add Total Instructions Executed to our EventSet
if ( PAPI_add_event( EventSet, PAPI_TOT_INS ) != PAPI_OK )
exit( 1 );
// Attach this EventSet to the forked process
if ( PAPI_attach( EventSet, pid ) != PAPI_OK )
exit( 1 );
π¦ See also π¦
PAPI_set_optPAPI_list_threadsPAPI_thread_idPAPI_thread_init
π Author π
Generated automatically by Doxygen for PAPI from the source code.
and thatβs the vibe check, bestie π this page is Version 7.2.0.0, dated Wed Jun 25 2025 19:30:48, and itβs the PAPI_detach(3) page. slay, bye π«Άβ¨
π¦ 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