We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent b172068 commit 4115fd6Copy full SHA for 4115fd6
fc_util/src/lib.rs
@@ -5,10 +5,14 @@ extern crate libc;
5
6
pub mod validators;
7
8
-#[cfg(target_arch = "x86_64")]
9
pub fn timestamp_cycles() -> u64 {
+ #[cfg(target_arch = "x86_64")]
10
// Safe because there's nothing that can go wrong with this call.
11
- unsafe { std::arch::x86_64::_rdtsc() as u64 }
+ unsafe {
12
+ std::arch::x86_64::_rdtsc() as u64
13
+ }
14
+ #[cfg(not(target_arch = "x86_64"))]
15
+ 0
16
}
17
18
fn timespec_to_us(time_struct: &libc::timespec) -> u64 {
@@ -29,6 +33,7 @@ pub fn now_cputime_us() -> u64 {
29
33
mod tests {
30
34
use super::*;
31
35
36
32
37
#[test]
38
fn test_timestamp_cycles() {
39
for _ in 0..1000 {
0 commit comments