@@ -31,15 +31,15 @@ use memmap2::{MmapMut, MmapOptions};
31
31
pub use stat:: SamplerStat ;
32
32
33
33
use crate :: {
34
- config,
35
- config:: { Cpu , Error , Process } ,
34
+ config:: { self , Cpu , Error , Process } ,
36
35
infra:: WrapResult ,
37
36
sampling:: {
38
37
record:: * ,
39
38
single:: { next_record:: next_record, stat:: sampler_stat} ,
40
39
Config ,
41
40
} ,
42
41
syscall:: { bindings:: * , ioctl_wrapped, perf_event_open_wrapped} ,
42
+ RawPerfEventAttr ,
43
43
} ;
44
44
45
45
pub struct Sampler {
@@ -64,6 +64,8 @@ pub struct Sampler {
64
64
pub ( crate ) regs_user_len : usize ,
65
65
#[ cfg( feature = "linux-3.19" ) ]
66
66
pub ( crate ) regs_intr_len : usize ,
67
+
68
+ pub ( crate ) perf_event_attr : RawPerfEventAttr ,
67
69
}
68
70
69
71
impl Sampler {
@@ -102,6 +104,7 @@ impl Sampler {
102
104
regs_user_len : perf_event_attr. sample_regs_user . count_ones ( ) as _ ,
103
105
#[ cfg( feature = "linux-3.19" ) ]
104
106
regs_intr_len : perf_event_attr. sample_regs_intr . count_ones ( ) as _ ,
107
+ perf_event_attr : perf_event_attr. 0 ,
105
108
}
106
109
. wrap_ok ( )
107
110
}
@@ -156,4 +159,8 @@ impl Sampler {
156
159
pub fn get_raw_fd ( & self ) -> i32 {
157
160
self . file . as_raw_fd ( )
158
161
}
162
+
163
+ pub fn perf_event_attr ( & self ) -> perf_event_attr {
164
+ self . perf_event_attr
165
+ }
159
166
}
0 commit comments