Blame src/libpfm4/docs/man3/pfm_find_event.3

Packit 577717
.TH LIBPFM 3  "September, 2009" "" "Linux Programmer's Manual"
Packit 577717
.SH NAME pfm_find_event \- search for an event masks
Packit 577717
.SH SYNOPSIS
Packit 577717
.nf
Packit 577717
.B #include <perfmon/pfmlib.h>
Packit 577717
.sp
Packit 577717
.BI "int pfm_find_event(const char *"str ");"
Packit 577717
.sp
Packit 577717
.SH DESCRIPTION
Packit 577717
This function is used to convert an event string passed in \fBstr\fR into an opaque
Packit 577717
event identifier, i.e., the return value.
Packit 577717
Packit 577717
Events are first manipulated a strings which contain the event name, sub-event
Packit 577717
names and optional filters and modifiers. This function analyzes the string
Packit 577717
and try to find the matching event.
Packit 577717
Packit 577717
The event string is a structured string and it is composed as follows:
Packit 577717
.TP
Packit 577717
.B [pmu_name::]event_name[:unit_mask][:modifier|:modifier=val]
Packit 577717
.PP
Packit 577717
Packit 577717
The various components are separated by \fB:\fR or \fB::\fR, they
Packit 577717
are defined as follows:
Packit 577717
Packit 577717
.TP
Packit 577717
.B pmu_name
Packit 577717
This is an optional prefix to designate a specific PMU model. With the
Packit 577717
prefix the event which matches the event_name is used. In case multiple
Packit 577717
PMU models are activated, there may be conflict with identical event
Packit 577717
names to mean the same or different things. In that case, it is necessary
Packit 577717
to fully specify the event with a pmu_name. That string corresponds to
Packit 577717
what is returned by \fBpfm_get_pmu_name()\fR.
Packit 577717
.TP
Packit 577717
.B event_name
Packit 577717
This is the event name and is required. The library is not case sensitive
Packit 577717
on event string. The event name must match \fBcompletely\fR the actual
Packit 577717
event name; it cannot be a substring.
Packit 577717
.TP
Packit 577717
.B unit_mask
Packit 577717
The optional unit mask which can be considered like a sub-event of the
Packit 577717
major event. If a event has unit masks, and there is no default, then
Packit 577717
at least one unit mask must be passed in the string. Multiple unit
Packit 577717
masks may be specified for a single event.
Packit 577717
.TP
Packit 577717
.B modifier
Packit 577717
A modifier is an optional filter which is provided by the hardware
Packit 577717
register hosting the event or by the underlying kernel infrastructure.
Packit 577717
Typical modifiers include privilege level filters. Some modifiers
Packit 577717
are simple boolean, in which case just passing their names is equivalent
Packit 577717
to setting their value to \fBtrue\fR. Other modifiers need a specific
Packit 577717
value, in which case it is provided after the equal sign. No space is
Packit 577717
tolerate around the equal sign. The list of modifiers depends on the
Packit 577717
host PMU and underlying kernel API. They are documented in PMU-specific
Packit 577717
documentation. Multiple modifiers may be passed. There is not order
Packit 577717
between unit masks and modifiers.
Packit 577717
.PP
Packit 577717
Packit 577717
The library uses the generic term \fBattribute\fR to designate both
Packit 577717
unit masks and modifiers.
Packit 577717
Packit 577717
Here are a few examples of event strings:
Packit 577717
.TP
Packit 577717
.B amd64::RETIRED_INSTRUCTIONS:u
Packit 577717
Event RETIRED_INSTRUCTION on AMD64 processor, measure at user privilege level only
Packit 577717
.TP
Packit 577717
.B RS_UOPS_DISPATCHED:c=1:i:u
Packit 577717
Event RS_UOPS_DISPATCHED measured at user privilege level only, and with counter-mask set to 1
Packit 577717
.PP
Packit 577717
For the purpose of this function, only the pmu_name and event_name
Packit 577717
are considered, everything else is parsed, thus must be valid, but is ignored.
Packit 577717
Packit 577717
The function searches only for one event per call. As a convenience, the function will
Packit 577717
identify the event up to the first comma. In other words, if \fBstr\fR is equal to
Packit 577717
"EVENTA,EVENTB", then the function will only look at EVENTA and will not return an
Packit 577717
error because of invalid event string. This is handy when parsing constant event
Packit 577717
strings containing multiple, comma-separated, events.
Packit 577717
Packit 577717
.SH RETURN
Packit 577717
The function returns the opaque event identifier that corresponds
Packit 577717
that the event string. In case of error, a negative error code
Packit 577717
is returned instead.
Packit 577717
.SH ERRORS
Packit 577717
.TP
Packit 577717
.B PFMLIB_ERR_NOINIT
Packit 577717
The library has not been initialized properly.
Packit 577717
.TP
Packit 577717
.B PFMLIB_ERR_INVAL
Packit 577717
The event string is NULL.
Packit 577717
.TP
Packit 577717
.B PFMLIB_ERR_NOMEM
Packit 577717
The library ran out of memory.
Packit 577717
.TP
Packit 577717
.B PFMLIB_ERR_NOTFOUND
Packit 577717
The event was not found
Packit 577717
.TP
Packit 577717
.B PFMLIB_ERR_ATTR
Packit 577717
Invalid event attribute
Packit 577717
.TP
Packit 577717
.B PFMLIB_ERR_ATTR_VAL
Packit 577717
Invalid event attribute value
Packit 577717
.TP
Packit 577717
.B PFMLIB_ERR_TOOMANY
Packit 577717
Too many event attributes passed
Packit 577717
.SH AUTHOR
Packit 577717
Stephane Eranian <eranian@gmail.com>
Packit 577717
.PP