pmc_attach, pmc_detach(3) | attaching and detaching process scope PMCs to target processes |
pmc_detach, pmc_attach(3) | attaching and detaching process scope PMCs to target processes |
PMC_ATTACH(3) | MidnightBSD Library Functions Manual | PMC_ATTACH(3) |
pmc_attach
,
pmc_detach
— attaching and
detaching process scope PMCs to target processes
Performance Counters Library (libpmc, -lpmc)
#include
<pmc.h>
int
pmc_attach
(pmc_id_t
pmcid, pid_t
pid);
int
pmc_detach
(pmc_id_t
pmcid, pid_t
pid);
These functions control the set of target processes tracked by a process scope PMC.
Function
pmc_attach
()
is used to attach a process scope PMC specified by argument
pmcid to a target process specified by argument
pid. Argument pid may be zero to
denote the current process. If the PMC was allocated with modifier
PMC_F_DESCENDANTS
, the PMC will additionally attach
to current and future descendents of the specified target process. The PMC
should be in a quiescent state (i.e., not running).
Function
pmc_detach
()
is used to detach a process scope PMC specified by argument
pmcid from a process specified by argument
pid. Argument pid may be zero to
denote the current process.
Upon successful completion, the value 0 is returned; otherwise the value -1 is returned and the global variable errno is set to indicate the error.
A call to function pmc_attach
() may fail
with the following errors:
EBUSY
]EBUSY
]EEXIST
]EINVAL
]EINVAL
]EINVAL
]EPERM
]EPERM
]ESRCH
]ESRCH
]A call to function pmc_detach
() may fail
with the following errors:
EINVAL
]EINVAL
]EINVAL
]EINVAL
]ESRCH
]ESRCH
]ESRCH
]November 25, 2007 | midnightbsd-3.1 |