.TH "PAPI_attach" 3 "Mon Dec 18 2017" "Version 5.6.0.0" "PAPI" \" -*- nroff -*-
.ad l
.nh
.SH NAME
PAPI_attach \-
.PP
Attach PAPI event set to the specified thread id\&.
.SH SYNOPSIS
.br
.PP
.SH "Detailed Description"
.PP
.PP
.nf
@par C Interface:
\#include <papi.h> @n
int PAPI_attach( int EventSet, unsigned long tid );
PAPI_attach 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 specifed thread;
PAPI_detach breaks that connection and restores the EventSet to the
original executing thread.
@param EventSet
An integer handle for a PAPI EventSet as created by PAPI_create_eventset.
@param tid
A thread id as obtained from, for example, PAPI_list_threads or PAPI_thread_id.
@retval PAPI_ECMP
This feature is unsupported on this component.
@retval PAPI_EINVAL
One or more of the arguments is invalid.
@retval PAPI_ENOEVST
The event set specified does not exist.
@retval PAPI_EISRUN
The event set is currently counting events.
@par Examples:
.fi
.PP
.PP
.nf
* 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 );
*
.fi
.PP
.PP
\fBSee Also:\fP
.RS 4
\fBPAPI_set_opt\fP
.PP
\fBPAPI_list_threads\fP
.PP
\fBPAPI_thread_id\fP
.PP
\fBPAPI_thread_init\fP
.RE
.PP
.SH "Author"
.PP
Generated automatically by Doxygen for PAPI from the source code\&.