1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
use bindings;
use crateEvent;
/// A raw perf counter for the current CPU.
///
/// Most CPUs have additional counters beyond those provided by the kernel.
/// `Raw` events allow you to access those events. Note that the values needed
/// to configure raw events a liable to change between CPU vendors and even
/// different hardware revisions of the same platform.
///
/// The event can be chosen by setting the `config` field. Most events will
/// only need that, but others may require setting the `config1` or `config2`
/// fields as well.
///
/// To find the config values required for counters consult your CPU manual.
/// - For Intel CPUs, see the Intel Software Developer Manual, volume 3B.
/// - For AMD, see the AMD BIOS and Kernel Developer Guide.
/// - Other vendors should have equivalent documentation.
///
/// Example:
///
/// ```no_run
/// use perf_event::events::Raw;
/// use perf_event::{Builder, Group};
///
/// // Raw config values for an ARMv8 PMU.
/// let INSNS_RETIRED: Raw = Raw::new(0x08);
/// let CPU_CYCLES: Raw = Raw::new(0x11);
///
/// let mut group = Group::new()?;
/// let raw_insns_retired = group.add(&Builder::new(INSNS_RETIRED).include_kernel())?;
/// let raw_cpu_cycles = group.add(&Builder::new(CPU_CYCLES).include_kernel())?;
/// # std::io::Result::Ok(())
/// ```