|
Packit |
577717 |
.TH LIBPFM 3 "December, 2009" "" "Linux Programmer's Manual"
|
|
Packit |
577717 |
.SH NAME
|
|
Packit |
577717 |
pfm_get_event_info \- get event information
|
|
Packit |
577717 |
.SH SYNOPSIS
|
|
Packit |
577717 |
.nf
|
|
Packit |
577717 |
.B #include <perfmon/pfmlib.h>
|
|
Packit |
577717 |
.sp
|
|
Packit |
577717 |
.BI "int pfm_get_event_info(int " idx ", pfm_os_t " os ", pfm_event_info_t *" info ");"
|
|
Packit |
577717 |
.sp
|
|
Packit |
577717 |
.SH DESCRIPTION
|
|
Packit |
577717 |
This function returns in \fBinfo\fR information about a specific event
|
|
Packit |
577717 |
designated by its opaque unique identifier in \fBidx\fR for the operating system
|
|
Packit |
577717 |
specified in \fBos\fR.
|
|
Packit |
577717 |
|
|
Packit |
577717 |
The \fBpfm_event_info_t\fR structure is defined as follows:
|
|
Packit |
577717 |
.nf
|
|
Packit |
577717 |
typedef struct {
|
|
Packit |
577717 |
const char *name;
|
|
Packit |
577717 |
const char *desc;
|
|
Packit |
577717 |
const char *equiv;
|
|
Packit |
577717 |
size_t size;
|
|
Packit |
577717 |
uint64_t code;
|
|
Packit |
577717 |
pfm_pmu_t pmu;
|
|
Packit |
577717 |
pfm_dtype_t dtype
|
|
Packit |
577717 |
int idx;
|
|
Packit |
577717 |
int nattrs;
|
|
Packit |
577717 |
struct {
|
|
Packit |
577717 |
unsigned int is_precise:1;
|
|
Packit |
577717 |
unsigned int reserved_bits:31;
|
|
Packit |
577717 |
};
|
|
Packit |
577717 |
} pfm_event_info_t;
|
|
Packit |
577717 |
.fi
|
|
Packit |
577717 |
|
|
Packit |
577717 |
The fields of this structure are defined as follows:
|
|
Packit |
577717 |
.TP
|
|
Packit |
577717 |
.B name
|
|
Packit |
577717 |
This is the name of the event. This is a read-only string.
|
|
Packit |
577717 |
.TP
|
|
Packit |
577717 |
.B desc
|
|
Packit |
577717 |
This is the description of the event. This is a read-only string. It may contain
|
|
Packit |
577717 |
multiple sentences.
|
|
Packit |
577717 |
.TP
|
|
Packit |
577717 |
.B equiv
|
|
Packit |
577717 |
Certain events may be just variations of actual events. They may be provided as
|
|
Packit |
577717 |
handy shortcuts to avoid supplying a long list of attributes. For those events,
|
|
Packit |
577717 |
this field is not NULL and contains the complete equivalent event string.
|
|
Packit |
577717 |
.TP
|
|
Packit |
577717 |
.B code
|
|
Packit |
577717 |
This is the raw event code. It should not be confused with the encoding
|
|
Packit |
577717 |
of the event. This field represents only the event selection code, it does
|
|
Packit |
577717 |
not include any unit mask or attribute settings.
|
|
Packit |
577717 |
.TP
|
|
Packit |
577717 |
.B pmu
|
|
Packit |
577717 |
This is the identification of the PMU model this event belongs to. It is
|
|
Packit |
577717 |
of type \fBpfm_pmu_t\fR. Using this value and the \fBpfm_get_pmu_info\fR
|
|
Packit |
577717 |
function, it is possible to get PMU information.
|
|
Packit |
577717 |
.TP
|
|
Packit |
577717 |
.B dtype
|
|
Packit |
577717 |
This field returns the representation of the event data. By default, it
|
|
Packit |
577717 |
is \fBPFM_DATA_UINT64\fR.
|
|
Packit |
577717 |
|
|
Packit |
577717 |
.B idx
|
|
Packit |
577717 |
This is the event unique opaque identifier. It is identical to the idx
|
|
Packit |
577717 |
passed to the call and is provided for completeness.
|
|
Packit |
577717 |
.TP
|
|
Packit |
577717 |
.B nattrs
|
|
Packit |
577717 |
This is the number of attributes supported by this event. Attributes
|
|
Packit |
577717 |
may be unit masks or modifiers. If the event has not attribute, then
|
|
Packit |
577717 |
the value of this field is simply 0.
|
|
Packit |
577717 |
.TP
|
|
Packit |
577717 |
.B size
|
|
Packit |
577717 |
This field contains the size of the struct passed. This field is used to provide
|
|
Packit |
577717 |
for extensibility of the struct without compromising backward compatibility.
|
|
Packit |
577717 |
The value should be set to \fBsizeof(pfm_event_info_t)\fR. If instead, a value of
|
|
Packit |
577717 |
\fB0\fR is specified, the library assumes the struct passed is identical to the
|
|
Packit |
577717 |
first ABI version which size is \fBPFM_EVENT_INFO_ABI0\fR. Thus, if fields were
|
|
Packit |
577717 |
added after the first ABI, they will not be set by the library. The library
|
|
Packit |
577717 |
does check that bytes beyond what is implemented are zeroes.
|
|
Packit |
577717 |
.TP
|
|
Packit |
577717 |
.B is_precise
|
|
Packit |
577717 |
This bitfield indicates whether or not the event support precise sampling.
|
|
Packit |
577717 |
Precise sampling is a hardware mechanism that avoids instruction address
|
|
Packit |
577717 |
skid when using interrupt-based sampling. When the event has umasks, this
|
|
Packit |
577717 |
field means that at least one umask supports precise sampling. On Intel X86
|
|
Packit |
577717 |
processors, this indicates whether the event supports Precise Event-Based
|
|
Packit |
577717 |
Sampling (PEBS).
|
|
Packit |
577717 |
.PP
|
|
Packit |
577717 |
|
|
Packit |
577717 |
The \fBpfm_os_t\fR enumeration provides the following choices:
|
|
Packit |
577717 |
.TP
|
|
Packit |
577717 |
.B PFM_OS_NONE
|
|
Packit |
577717 |
The returned information pertains only to what the PMU hardware exports.
|
|
Packit |
577717 |
No operating system attributes is taken into account.
|
|
Packit |
577717 |
.TP
|
|
Packit |
577717 |
.B PFM_OS_PERF_EVENT
|
|
Packit |
577717 |
The returned information includes the actual PMU hardware and the
|
|
Packit |
577717 |
additional attributes exported by the perf_events kernel interface.
|
|
Packit |
577717 |
The perf_event attributes pertain only the PMU hardware.
|
|
Packit |
577717 |
In case perf_events is not detected, an error is returned.
|
|
Packit |
577717 |
.TP
|
|
Packit |
577717 |
.B PFM_OS_PERF_EVENT_EXT
|
|
Packit |
577717 |
The returned information includes all of what is already provided
|
|
Packit |
577717 |
by \fBPFM_OS_PERF_EVENT\fR plus all the software attributes controlled
|
|
Packit |
577717 |
by perf_events, such as sampling period, precise sampling.
|
|
Packit |
577717 |
.PP
|
|
Packit |
577717 |
.SH RETURN
|
|
Packit |
577717 |
|
|
Packit |
577717 |
If successful, the function returns \fBPFM_SUCCESS\fR and event information
|
|
Packit |
577717 |
in \fBinfo\fR, otherwise it returns an error code.
|
|
Packit |
577717 |
.SH ERRORS
|
|
Packit |
577717 |
.TP
|
|
Packit |
577717 |
.B PFMLIB_ERR_NOINIT
|
|
Packit |
577717 |
Library has not been initialized properly.
|
|
Packit |
577717 |
.TP
|
|
Packit |
577717 |
.B PFMLIB_ERR_INVAL
|
|
Packit |
577717 |
The \fBidx\fR argument is invalid or \fBinfo\fR is \fBNULL\fR or \fBsize\fR
|
|
Packit |
577717 |
is not zero.
|
|
Packit |
577717 |
.TP
|
|
Packit |
577717 |
.B PFMLIB_ERR_NOTSUPP
|
|
Packit |
577717 |
The requested \fBos\fR is not detected or supported.
|
|
Packit |
577717 |
.SH AUTHOR
|
|
Packit |
577717 |
Stephane Eranian <eranian@gmail.com>
|
|
Packit |
577717 |
.PP
|