@@ -303,7 +303,7 @@ const BUG_REPORT_MSG: &str =
303
303
"please report this to https://github.com/rust-lang/measureme/issues/new" ;
304
304
305
305
/// Linux x86_64 implementation based on `perf_event_open` and `rdpmc`.
306
- #[ cfg( all( target_arch = "x86_64" , target_os = "linux" ) ) ]
306
+ #[ cfg( all( target_arch = "x86_64" , target_os = "linux" , not ( target_env = "ohos" ) ) ) ]
307
307
mod hw {
308
308
use memmap2:: { Mmap , MmapOptions } ;
309
309
use perf_event_open_sys:: { bindings:: * , perf_event_open} ;
@@ -349,10 +349,12 @@ mod hw {
349
349
type_ : perf_type_id ,
350
350
hw_id : u32 ,
351
351
) -> Result < Self , Box < dyn Error + Send + Sync > > {
352
- let mut attrs = perf_event_attr:: default ( ) ;
353
- attrs. size = mem:: size_of :: < perf_event_attr > ( ) . try_into ( ) . unwrap ( ) ;
354
- attrs. type_ = type_;
355
- attrs. config = hw_id. into ( ) ;
352
+ let mut attrs = perf_event_attr {
353
+ size : mem:: size_of :: < perf_event_attr > ( ) . try_into ( ) . unwrap ( ) ,
354
+ type_,
355
+ config : hw_id. into ( ) ,
356
+ ..perf_event_attr:: default ( )
357
+ } ;
356
358
357
359
// Only record same-thread, any CPUs, and only userspace (no kernel/hypervisor).
358
360
// NOTE(eddyb) `pid = 0`, despite talking about "process id", means
@@ -933,7 +935,7 @@ mod hw {
933
935
}
934
936
}
935
937
936
- #[ cfg( not( all( target_arch = "x86_64" , target_os = "linux" ) ) ) ]
938
+ #[ cfg( not( all( target_arch = "x86_64" , target_os = "linux" , not ( target_env = "ohos" ) ) ) ) ]
937
939
mod hw {
938
940
use std:: error:: Error ;
939
941
0 commit comments