1LIBPFM(3) Linux Programmer's Manual LIBPFM(3)
2
3
4
6 pfm_get_pmu_name, pfm_get_pmu_type, pfm_get_pmu_name_bytype,
7 pfm_pmu_is_supported, pfm_force_pmu,pfm_list_supported_pmu - query
8 library about supported PMU models
9
11 #include <perfmon/pfmlib.h>
12
13 int pfm_get_pmu_name(char *name, int maxlen);
14 int pfm_get_pmu_type(int *type);
15 int pfm_get_pmu_name_bytype(int type, char *name, int maxlen);
16 int pfm_pmu_is_supported(int type);
17 int pfm_force_pmu(int type);
18 int pfm_list_supported_pmus(int (*pf)(const char *fmt,...));
19
20
22 These functions retrieve information about the detected host PMU and
23 the PMU models supported by the library. More than one model can be
24 supported by the same library.
25
26 Each PMU model is assigned a type and a name. The latter is just a
27 string and the former is a unique identifier. The currently supported
28 types are:
29
30 PFMLIB_GENERIC_PMU
31 the default architected PMU model, i.e., the basic model.
32
33 PFMLIB_ITANIUM_PMU
34 the Itanium processor PMU model. The model is found in the first
35 implementation of the IA-64 architecture, code name Merced.
36
37 PFMLIB_ITANIUM2_PMU
38 the Itanium 2 processor PMU model. This is the model provided by
39 McKinley, Madison, and Deerfield processors.
40
41 The pfm_get_pmu_name function returns the name of the detected host
42 PMU. The library must have been initialized properly before making this
43 call. The name is returned in the name argument. The maxlen argument
44 indicates the maximum length of the buffer provided for name. Up to
45 maxlen-1 characters will be returned, not including the termination
46 character.
47
48
49 The pfm_get_pmu_type function returns the type of the detected host
50 PMU. The library must have been initialized properly before making this
51 call. The type returned in type can be any one of the three listed
52 above.
53
54 The pfm_get_pmu_name_bytype function returns the name of a PMU model in
55 name given a type in the type argument. The maxlen argument indicates
56 the maximum length of the buffer provided for name. Up to maxlen-1
57 characters will be returned, not including the termination character.
58
59
60 The pfm_pmu_is_supported function returns PFMLIB_SUCCESS if the given
61 PMU type is supported by the library independently of what the host PMU
62 model is.
63
64 The pfm_force_pmu function is used to forced the library to use a par‐
65 ticular PMU model compared to what it has detected. The library checks
66 that the selected type can be supported by the host PMU. This is mostly
67 useful to force the library to the use generic PMU model PFM‐
68 LIB_GENERIC_PMU. This function can be called at any time and upon
69 return the library is considered initialized.
70
71 The pfm_list_supported_pmu function is used to print the list PMU types
72 that the library supports. The results is printed using the function
73 provided in the pf argument, which must be a printf-style function.
74
76 The function returns whether or not it was successful. A return value
77 of PFMLIB_SUCCESS indicates success, otherwise the value is the error
78 code.
79
81 PFMLIB_ERR_NOINIT the library has not been initialized properly.
82
83 PFMLIB_ERR_INVAL
84 invalid argument was given, most likely invalid pointer or
85 invalid PMU type.
86
87 PFMLIB_ERR_NOTSUPP
88 the selected PMU type can be used on the host CPU.
89
91 Stephane Eranian <eranian@hpl.hp.com>
92
93 November, 2003 LIBPFM(3)