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

Packit Service a1973e
.TH LIBPFM 3  "December, 2009" "" "Linux Programmer's Manual"
Packit Service a1973e
.SH NAME
Packit Service a1973e
pfm_get_event_attr_info \- get event attribute information
Packit Service a1973e
.SH SYNOPSIS
Packit Service a1973e
.nf
Packit Service a1973e
.B #include <perfmon/pfmlib.h>
Packit Service a1973e
.sp
Packit Service a1973e
.BI "int pfm_get_event_attr_info(int " idx ", int " attr ", pfm_os_t " os ", pfm_event_attr_info_t *" info ");"
Packit Service a1973e
.sp
Packit Service a1973e
.SH DESCRIPTION
Packit Service a1973e
This function returns in \fBinfo\fR information about the
Packit Service a1973e
attribute designated by \fBattr\fR for the event specified
Packit Service a1973e
in \fBidx\fR and the os layer in \fBos\fR.
Packit Service a1973e
Packit Service a1973e
The \fBpfm_os_t\fR enumeration provides the following choices:
Packit Service a1973e
.TP
Packit Service a1973e
.B PFM_OS_NONE
Packit Service a1973e
The returned information pertains only to what the PMU hardware exports.
Packit Service a1973e
No operating system attributes is taken into account.
Packit Service a1973e
.TP
Packit Service a1973e
.B PFM_OS_PERF_EVENT
Packit Service a1973e
The returned information includes the actual PMU hardware and the
Packit Service a1973e
additional attributes exported by the perf_events kernel interface.
Packit Service a1973e
The perf_event attributes pertain only the PMU hardware.
Packit Service a1973e
In case perf_events is not detected, an error is returned.
Packit Service a1973e
.TP
Packit Service a1973e
.B PFM_OS_PERF_EVENT_EXT
Packit Service a1973e
The returned information includes all of what is already provided
Packit Service a1973e
by \fBPFM_OS_PERF_EVENT\fR plus all the software attributes controlled
Packit Service a1973e
by perf_events, such as sampling period, precise sampling.
Packit Service a1973e
.PP
Packit Service a1973e
Packit Service a1973e
The \fBpfm_event_attr_info_t\fR structure is defined as follows:
Packit Service a1973e
.nf
Packit Service a1973e
typedef struct {
Packit Service a1973e
        const char              *name;
Packit Service a1973e
        const char              *desc;
Packit Service a1973e
        const char              *equiv;
Packit Service a1973e
        size_t			size;
Packit Service a1973e
        uint64_t                code;
Packit Service a1973e
        pfm_attr_t              type;
Packit Service a1973e
        int                     idx;
Packit Service a1973e
        pfm_attr_ctrl_t         ctrl;
Packit Service a1973e
        int                     reserved1;
Packit Service a1973e
        struct {
Packit Service a1973e
                int             is_dfl:1;
Packit Service a1973e
                int             is_precise:1;
Packit Service a1973e
                int             reserved:30;
Packit Service a1973e
        };
Packit Service a1973e
        union {
Packit Service a1973e
                uint64_t        dfl_val64;
Packit Service a1973e
                const char      *dfl_str;
Packit Service a1973e
                int             dfl_bool;
Packit Service a1973e
                int             dfl_int;
Packit Service a1973e
        };
Packit Service a1973e
} pfm_event_attr_info_t;
Packit Service a1973e
.fi
Packit Service a1973e
Packit Service a1973e
The fields of this structure are defined as follows:
Packit Service a1973e
.TP
Packit Service a1973e
.B name
Packit Service a1973e
This is the name of the attribute. This is a read-only string.
Packit Service a1973e
.TP
Packit Service a1973e
.B desc
Packit Service a1973e
This is the description of the attribute. This is a read-only string.
Packit Service a1973e
It may contain multiple sentences.
Packit Service a1973e
.TP
Packit Service a1973e
.B equiv
Packit Service a1973e
Certain attributes may be just variations of other attributes for the same event.
Packit Service a1973e
They may be provided as handy shortcuts to avoid supplying a long list of attributes.
Packit Service a1973e
For those attributes, this field is not NULL and contains the complete equivalent attribute
Packit Service a1973e
string. This string, once appended to the event name, may be used library calls requiring
Packit Service a1973e
an event string.
Packit Service a1973e
.TP
Packit Service a1973e
.B code
Packit Service a1973e
This is the raw attribute code. For PFM_ATTR_UMASK, this is the unit mask code. For
Packit Service a1973e
all other attributes, this is an opaque index.
Packit Service a1973e
.TP
Packit Service a1973e
.B type
Packit Service a1973e
This is the type of the attribute. Attributes represent either sub-events or extra
Packit Service a1973e
filters that can be applied to the event. Filters (also called modifiers)  may be
Packit Service a1973e
tied to the event or the PMU register the event is programmed into. The type of an attribute
Packit Service a1973e
determines how it must be specified. The following types are defined:
Packit Service a1973e
.RS
Packit Service a1973e
.TP
Packit Service a1973e
.B PFM_ATTR_UMASK
Packit Service a1973e
This is a unit mask, i.e., a sub-event. It is specified using its name.
Packit Service a1973e
Depending on the event, it may be possible to specify multiple unit masks.
Packit Service a1973e
.TP
Packit Service a1973e
.B PFM_ATTR_MOD_BOOL
Packit Service a1973e
This is a boolean attribute. It has a value of 0, 1, y or n. The
Packit Service a1973e
value is specified after the equal sign, e.g., foo=1. As a convenience,
Packit Service a1973e
the equal sign and value may be omitted, in which case this is equivalent
Packit Service a1973e
to =1.
Packit Service a1973e
.TP
Packit Service a1973e
.B PFM_ATTR_MOD_INTEGER
Packit Service a1973e
This is an integer attribute. It has a value which must be passed after
Packit Service a1973e
the equal sign. The range of valid values depends on the attribute and
Packit Service a1973e
is usually specified in its description.
Packit Service a1973e
.PP
Packit Service a1973e
.RE
Packit Service a1973e
.TP
Packit Service a1973e
.B idx
Packit Service a1973e
This is the attribute index. It is identical to the value of \fBattr\fR
Packit Service a1973e
passed to the call and is provided for completeness.
Packit Service a1973e
.TP
Packit Service a1973e
.B size
Packit Service a1973e
This field contains the size of the struct passed. This field is used to provide
Packit Service a1973e
for extensibility of the struct without compromising backward compatibility.
Packit Service a1973e
The value should be set to \fBsizeof(pfm_event_attr_info_t)\fR. If instead, a value of
Packit Service a1973e
\fB0\fR is specified, the library assumes the struct passed is identical to the
Packit Service a1973e
first ABI version which size is \fBPFM_ATTR_INFO_ABI0\fR. Thus, if fields were
Packit Service a1973e
added after the first ABI, they will not be set by the library. The library
Packit Service a1973e
does check that bytes beyond what is implemented are zeroes.
Packit Service a1973e
.TP
Packit Service a1973e
.B is_dfl
Packit Service a1973e
This field indicates whether or not this attribute is set by default. This
Packit Service a1973e
applies mostly for PFM_ATTR_UMASK. If a unit mask is marked as default,
Packit Service a1973e
and no unit mask is specified in the event string, then the library uses
Packit Service a1973e
it by default. Note that there may be multiple defaults per event depending
Packit Service a1973e
on how unit masks are grouped.
Packit Service a1973e
.TP
Packit Service a1973e
.B is_precise
Packit Service a1973e
This field indicates whether or not this umask supports precise sampling.
Packit Service a1973e
Precise sampling is a hardware mechanism that avoids instruction address
Packit Service a1973e
skid when using interrupt-based sampling. On Intel X86 processors, this
Packit Service a1973e
field indicates that the umask supports Precise Event-Based Sampling (PEBS).
Packit Service a1973e
.TP
Packit Service a1973e
.B dfl_val64, dfl_str, dfl_bool, dfl_int
Packit Service a1973e
This union contains the value of an attribute. For PFM_ATTR_UMASK, the is
Packit Service a1973e
the unit mask code, for all other types this is the actual value of the
Packit Service a1973e
attribute.
Packit Service a1973e
.TP
Packit Service a1973e
.B ctrl
Packit Service a1973e
This field indicates which layer or source controls the attribute.
Packit Service a1973e
The following sources are defined:
Packit Service a1973e
.RS
Packit Service a1973e
.TP
Packit Service a1973e
.B PFM_ATTR_CTRL_UNKNOWN
Packit Service a1973e
The source controlling the attribute is not known.
Packit Service a1973e
.TP
Packit Service a1973e
.B PFM_ATTR_CTRL_PMU
Packit Service a1973e
The attribute is controlled by the PMU hardware.
Packit Service a1973e
.TP
Packit Service a1973e
.B PFM_ATTR_CTRL_PERF_EVENT
Packit Service a1973e
The attribute is controlled by the perf_events kernel interface.
Packit Service a1973e
.RE
Packit Service a1973e
.TP
Packit Service a1973e
.B reserved
Packit Service a1973e
These fields must be set to zero.
Packit Service a1973e
.PP
Packit Service a1973e
Packit Service a1973e
.SH RETURN
Packit Service a1973e
Packit Service a1973e
If successful, the function returns \fBPFM_SUCCESS\fR and attribute information
Packit Service a1973e
in \fBinfo\fR, otherwise it returns an error code.
Packit Service a1973e
.SH ERRORS
Packit Service a1973e
.TP
Packit Service a1973e
.B PFMLIB_ERR_NOINIT
Packit Service a1973e
Library has not been initialized properly.
Packit Service a1973e
.TP
Packit Service a1973e
.B PFMLIB_ERR_INVAL
Packit Service a1973e
The \fBidx\fR or \fBattr\fR arguments are invalid or \fBinfo\fR is \fBNULL\fR or \fBsize\fR
Packit Service a1973e
is not zero.
Packit Service a1973e
.TP
Packit Service a1973e
.B PFM_ERR_NOTSUPP
Packit Service a1973e
The requested os layer has not been detected on the host system.
Packit Service a1973e
.SH AUTHOR
Packit Service a1973e
Stephane Eranian <eranian@gmail.com>
Packit Service a1973e
.PP