int
pmc_get_num_counters(
void
)
int
pmc_get_counter_type(
int ctr
)
void
pmc_save_context(
struct lwp *l
)
void
pmc_restore_context(
struct lwp *l
)
int
pmc_enable_counter(
struct lwp *l
, int ctr
)
int
pmc_disable_counter(
struct lwp *l
, int ctr
)
int
pmc_counter_isrunning(
struct lwp *l
, int ctr
)
int
pmc_counter_isconfigured(
struct lwp *l
, int ctr
)
int
pmc_configure_counter(
struct lwp *l
, int ctr
, struct pmc_counter_cfg *cfg
)
int
pmc_get_counter_value(
struct lwp *l
, int ctr
, int flags
, uint64_t *pval
)
int
pmc_accumulate(
struct lwp *l_parent
, struct lwp *l_exiting
)
int
pmc_alloc_kernel_counter(
int ctr
, struct pmc_counter_cfg *cfg
)
int
pmc_free_kernel_counter(
int ctr
)
int
pmc_start_profiling(
int ctr
, struct pmc_counter_cfg *cfg
)
int
pmc_stop_profiling(
int ctr
)
int
PMC_ENABLED(
struct lwp *l
)
The pmc interface is intended to allow monitoring from within the kernel as well as monitoring of userland applications. If the hardware can interrupt the CPU in a specific implementation, then it may also be used as a profiling source instead of the clock.
machine/pmc.h
>.
Counters are numbered from 0 to
N-1
where
N
is the number of counters available on the system
(see
pmc_get_num_counters()
below).
Upon a process fork, implementations must
pmc_evid_t
pmc_ctr_t
Counters are configured with the
struct
pmc_counter_cfg
.
This structure is defined as
struct pmc_counter_cfg {
pmc_evid_t event_id;
pmc_ctr_t reset_value;
uint32_t flags;
};
flags
are currently unused.
void
)
ctr
in the interface entry points below are from zero to one less than the
return value from this function.
int ctr
)
ctr
is specified as -1, returns a machine-dependent type describing the
CPU or counter configuration.
For example, on an ia32 architecture, it may distinguish between
586-, 686-, and K7-style counters.
struct lwp *l
)
struct lwp *l
)
struct lwp *l
, int ctr
)
ctr
for the specified process.
The counter should have already been configured with a call to
pmc_configure_counter(
).
This starts the counter running if it is not already started and enables
any interrupts, as appropriate.
struct lwp *l
, int ctr
)
ctr
for the specified process.
This stops the counter from running, and disables any interrupts,
as appropriate.
struct lwp *l
, int ctr
)
struct lwp *l
, int ctr
)
struct lwp *l
, int ctr
, struct pmc_counter_cfg *cfg
)
ctr
according to the configuration information stored in
cfg
.
struct lwp *l
, int ctr
, int flags
, uint64_t *pval
)
ctr
in the space pointed to by
pval
.
The only recognized flag is
PMC_VALUE_FLAGS_CHILDREN
which specifies that the returned counts should be accumulated values
for any exited child processes.
struct lwp *l_parent
, struct lwp *l_exiting
)
p_exiting
into the counters for the parent process
p_parent
.
int ctr
, struct pmc_counter_cfg *cfg
)
ctr
for use by the kernel and configures it with
cfg
.
int ctr
)
ctr
to the available pool of counters that may be used by processes.
int ctr
, struct pmc_counter_cfg *cfg
)
ctr
for use by the kernel for profiling and configures it with
cfg
.
int ctr
)
ctr
.
struct lwp *l
)