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
90
91
92
93
94
95
96
97
use File;
use Result;
use ;
use slice;
use cratesyscall;
// https://github.com/torvalds/linux/blob/v6.13/include/uapi/linux/perf_event.h#L580
// struct perf_event_mmap_page {
// u32 version; /* version number of this structure */
// u32 compat_version; /* lowest version this is compat with */
//
// u32 lock; /* seqlock for synchronization */
// u32 index; /* hardware event identifier */
// s64 offset; /* add to hardware event value */
// u64 time_enabled; /* time event active */
// u64 time_running; /* time event on CPU */
// union {
// u64 capabilities;
// struct {
// u64 cap_bit0 : 1, /* Always 0, deprecated, see commit 860f085b74e9 */
// cap_bit0_is_deprecated: 1, /* Always 1, signals that bit 0 is zero */
// cap_user_rdpmc : 1, /* The RDPMC instruction can be used to read counts */
// cap_user_time : 1, /* The time_{shift,mult,offset} fields are used */
// cap_user_time_zero : 1, /* The time_zero field is used */
// cap_user_time_short : 1, /* the time_{cycle,mask} fields are used */
// cap_____res : 58;
// };
// };
//
// u16 pmc_width;
//
// u16 time_shift;
// u32 time_mult;
// u64 time_offset;
// u64 time_zero;
//
// u32 size;
// u32 __reserved_1;
//
// u64 time_cycles;
// u64 time_mask;
//
// u8 __reserved[116*8];
//
// u64 data_head; /* head in the data section */
// u64 data_tail; /* user-space written tail */
// u64 data_offset; /* where the buffer starts */
// u64 data_size; /* data buffer size */
//
// u64 aux_head;
// u64 aux_tail;
// u64 aux_offset;
// u64 aux_size;
// };