File tree Expand file tree Collapse file tree 1 file changed +13
-4
lines changed
crates/codspeed/src/instrument_hooks Expand file tree Collapse file tree 1 file changed +13
-4
lines changed Original file line number Diff line number Diff line change 33
44#[ cfg( use_instrument_hooks) ]
55mod linux_impl {
6- use nix:: sys:: time:: TimeValLike ;
76
87 use super :: ffi;
98 use std:: ffi:: CString ;
@@ -116,9 +115,19 @@ mod linux_impl {
116115
117116 #[ inline( always) ]
118117 pub fn current_timestamp ( ) -> u64 {
119- nix:: time:: clock_gettime ( nix:: time:: ClockId :: CLOCK_MONOTONIC )
120- . expect ( "Failed to get current time" )
121- . num_nanoseconds ( ) as u64
118+ #[ cfg( target_os = "linux" ) ]
119+ {
120+ use nix:: sys:: time:: TimeValLike ;
121+
122+ nix:: time:: clock_gettime ( nix:: time:: ClockId :: CLOCK_MONOTONIC )
123+ . expect ( "Failed to get current time" )
124+ . num_nanoseconds ( ) as u64
125+ }
126+
127+ #[ cfg( not( target_os = "linux" ) ) ]
128+ unsafe {
129+ ffi:: instrument_hooks_current_timestamp ( )
130+ }
122131 }
123132 }
124133
You can’t perform that action at this time.
0 commit comments