1LIBPFM(3) Linux Programmer's Manual LIBPFM(3)
2
3
4
6 pfm_get_pmu_info - get PMU information
7
9 #include <perfmon/pfmlib.h>
10
11 int pfm_get_pmu_info(pfm_pmu_t pmu, pfm_pmu_info_t *info);
12
13
15 This function returns in info information about a PMU model designated
16 by its identifier in pmu.
17
18 The pfm_pmu_info structure is defined as follows:
19 typedef struct {
20 const char *name;
21 const char *desc;
22 pfm_pmu_t pmu;
23 pfm_pmu_type_t type;
24 int size;
25 int nevents;
26 int first_event;
27 int max_encoding;
28 int num_cntrs;
29 int num_fixed_cntrs;
30 struct {
31 int is_present:1;
32 int is_arch_default:1;
33 int is_core:1;
34 int is_uncore:1;
35 int reserved:28;
36 };
37 } pfm_pmu_info_t;
38
39 The fields of this structure are defined as follows:
40
41 name This is the symbolic name of the PMU. This name can be used as a
42 prefix in an event string. This is a read-only string.
43
44 desc This is the description of PMU. This is a read-only string.
45
46 pmu This is the unique PMU identification code. It is identical to
47 the value passed in pmu and it provided only for completeness.
48
49 type This field contains the type of the PMU. The following types are
50 defined:
51
52 PFM_PMU_TYPE_UNKNOWN
53 The type of the PMU could not be determined.
54
55 PFM_PMU_TYPE_CORE
56 This field is set to one when the PMU is implemented by
57 the processor core.
58
59 PFM_PMU_TYPE_UNCORE
60 This field is set to one when the PMU is implemented on
61 the processor die but at the socket level, i.e., captur‐
62 ing events for all cores.
63
64 nevents
65 This is the number of available events for this PMU model based
66 on the host processor. It is only valid if the is_present field
67 is set to 1. Event identifiers are not guaranteed contiguous. In
68 other words, it is not because nevents is equal to 100, that
69 event identifiers go from 0 to 99. The iterator function
70 pfm_get_event_next() must be used to go from one identifier to
71 the next.
72
73 first_event
74 This field returns the opaque index of the first event for this
75 PMU model. The index can be used with pfm_get_event_info() or
76 pfm_get_event_next() functions. In case no event is available,
77 this field contains -1.
78
79 num_cntrs
80 This field contains the number of generic counters supported by
81 the PMU. A counter is generic if it can count more than one
82 event. When it is not possible to determine the number of
83 generic counters, this field contains -1.
84
85 num_fixed_cntrs
86 This field contains the number of fixed counters supported by
87 the PMU. A counter is fixed if it hardwired to count only one
88 event. When it is not possible to determine the number of
89 generic counters, this field contains -1.
90
91
92 size This field contains the size of the struct passed. This field is
93 used to provide for extensibility of the struct without compro‐
94 mising backward compatibility. The value should be set to
95 sizeof(pfm_pmu_info_t). If instead, a value of 0 is specified,
96 the library assumes the struct passed is identical to the first
97 ABI version which size is PFM_PMU_INFO_ABI0. Thus, if fields
98 were added after the first ABI, they will not be set by the
99 library. The library does check that bytes beyond what is imple‐
100 mented are zeroes.
101
102 max_encoding
103 This field returns the number of event codes returned by
104 pfm_get_event_encoding().
105
106 is_present
107 This field is set to one is the PMU model has been detected on
108 the host system.
109
110 is_dfl This field is set to one if the PMU is the default PMU for this
111 architecture. Otherwise this field is zero.
112
114 If successful, the function returns PFM_SUCCESS and PMU information in
115 info, otherwise it returns an error code.
116
118 PFMLIB_ERR_NOINIT
119 Library has not been initialized properly.
120
121 PFMLIB_ERR_NOTSUPP
122 PMU model is not supported by the library.
123
124 PFMLIB_ERR_INVAL
125 The pmu argument is invalid or info is NULL or size is not zero.
126
128 pfm_get_event_next(3)
129
131 Stephane Eranian <eranian@gmail.com>
132
133 December, 2009 LIBPFM(3)