1LIBPFM(3) Linux Programmer's Manual LIBPFM(3)
2
3
4
6 pfm_get_impl_pmcs, pfm_get_impl_pmds, pfm_get_impl_counters,
7 pfm_get_num_counters, pfm_get_num_pmcs, pfm_get_num_pmds,
8 pfm_get_hw_counter_width - return bitmask of implemented PMU registers
9 or number of PMU registers
10
12 #include <perfmon/pfmlib.h>
13
14 int pfm_get_impl_pmcs(pfmlib_regmask_t *impl_pmcs);
15 int pfm_get_impl_pmds(pfmlib_regmask_t *impl_pmds);
16 int pfm_get_impl_counters(pfmlib_regmask_t *impl_counters);
17 int pfm_get_num_counters(unsigned int *num);
18 int pfm_get_num_pmcs(unsigned int *num);
19 int pfm_get_num_pmds(unsigned int *num);
20 int pfm_get_num_counters(unsigned int *num);
21 int pfm_get_hw_counter_width(unsigned int *width);
22
23
25 The pfm_get_impl_* functions can be used to figure out which PMU regis‐
26 ters are implemented on the host CPU. They all return a bitmask of reg‐
27 isters corresponding to the query. The number of implemented PMU regis‐
28 ters (PMDS, PMCS) can vary from one implementation to another. Simi‐
29 larly, the number of PMD register which can be used as counters can
30 vary.
31
32 The pfm_get_impl_pmcs returns in impl_pmcs the bitmask of implemented
33 PMCS.
34
35 The pfm_get_impl_pmds returns in impl_pmds the bitmask of implemented
36 PMDS.
37
38 The pfm_get_impl_counters returns in impl_counters a bitmask of the
39 PMD/PMC pairs which can be used as counters. PMU registers can be used
40 for very different purposes: control, counting, buffers. The counters
41 are used to accumulate the number of occurrences of events and are typ‐
42 ically the one used by monitoring tools.
43
44 The returned bitmask must be accessed using the set of functions pro‐
45 vided by the library to ensure portability. See related man pages
46 below.
47
48 The pfm_get_num_counters function returns in num the number of counters
49 implemented by the host PMU. A counter is a PMD which is used to accu‐
50 mulate the number of occurences of an event.
51
52 The pfm_get_num_pmcs function returns in num the number of implemented
53 PMCs by the host PMU.
54
55 The pfm_get_num_pmds function returns in num the number of implemented
56 PMDs by the host PMU.
57
58 The pfm_get_hw_counter_width function returns the width in bits of the
59 counters in width. PMU implementations can have different number of
60 bits implemented. For instance, Itanium has 32-bit counters, while Ita‐
61 nium 2 has 47-bits. Depending on the OS interface, you may not have to
62 care about the width and assume counters are 64 bits. This is the case
63 for the Linux/ia64 perfmon subsystem where the interface exports all
64 counters as 64-bit wide.
65
67 The function returns whether or not it was successful. A return value
68 of PFMLIB_SUCCESS indicates success, otherwise the value is the error
69 code.
70
72 PFMLIB_ERR_NOINIT the library has not been initialized properly.
73
75 pfm_regmask_set(3), pfm_regmask_isset(3)
76
78 Stephane Eranian <eranian@hpl.hp.com>
79
80 July, 2003 LIBPFM(3)