CPU Performance Counters Library Functions
cpc_pctx_bind_event(3CPC)
NAME
cpc_pctx_bind_event, cpc_pctx_take_sample, cpc_pctx_rele,
cpc_pctx_invalidate - access CPU performance counters in
other processesSYNOPSIS
cc [ flag... ] file... -lcpc -lpctx [ library... ]
#include
#include
int cpc_pctx_bind_event(pctx_t *pctx, id_t lwpid, cpc_event_t *event,
int flags);int cpc_pctx_take_sample(pctx_t *pctx, id_t lwpid, cpc_event_t *event);
int cpc_pctx_rele(pctx_t *pctx, id_t lwpid);
int cpc_pctx_invalidate(pctx_t *pctx, id_t lwpid);
DESCRIPTION
These functions are designed to be run in the context of an event handler created using the libpctx(3LIB) family offunctions that allow the caller, also known as the control-
ling process, to manipulate the performance counters in the context of a controlled process. The controlled process is described by the pctx argument, which must be obtained froman invocation of pctx_capture(3CPC) or pctx_create(3CPC) and
passed to the functions described on this page in the con-
text of an event handler.The semantics of the functions cpc_pctx_bind_event(),
cpc_pctx_take_sample(), and cpc_pctx_rele() are directly
analogous to those of cpc_bind_event(), cpc_take_sample(),
and cpc_rele() described on the cpc_bind_event(3CPC) manual
page.The cpc_pctx_invalidate() function allows the performance
context to be invalidated in an LWP in the controlled pro-
cess.RETURN VALUES
These functions return 0 on success. On failure, theyreturn -1 and set errno to indicate the error.
SunOS 5.11 Last change: 05 Mar 2007 1
CPU Performance Counters Library Functionscpc_pctx_bind_event(3CPC)
ERRORS
The cpc_pctx_bind_event(), cpc_pctx_take_sample(), and
cpc_pctx_rele() functions return the same errno values the
analogous functions described on the cpc_bind_event(3CPC)
manual page. In addition, these function may fail if:EACCES For cpc_pctx_bind_event(), access to the requested
hypervisor event was denied. ESRCH The value of the lwpid argument is invalid in the context of the controlled process.ATTRIBUTES
See attributes(5) for descriptions of the following attri-
butes:____________________________________________________________
| ATTRIBUTE TYPE | ATTRIBUTE VALUE |
|_____________________________|_____________________________|
| MT-Level | Unsafe |
|_____________________________|_____________________________|
| Interface Stability | Committed ||_____________________________|_____________________________|
SEE ALSO
cpc(3CPC), cpc_bind_event(3CPC), libcpc(3LIB),
pctx_capture(3CPC), pctx_create(3CPC), attributes(5)
NOTESThe cpc_pctx_bind_event(), cpc_pctx_invalidate(),
cpc_pctx_rele(), and cpc_pctx_take_sample() functions exist
for binary compatibility only. Source containing these func-
tions will not compile. These functions are obsolete and might be removed in a future release. Applications shoulduse cpc_bind_pctx(3CPC), cpc_unbind(3CPC), and
cpc_set_sample(3CPC) instead.
The capability to create and analyze overflow events in other processes is not available, though it may be made available in a future version of this API. In the current implementation, the flags field must be specified as 0.SunOS 5.11 Last change: 05 Mar 2007 2
CPU Performance Counters Library Functionscpc_pctx_bind_event(3CPC)
SunOS 5.11 Last change: 05 Mar 2007 3