Skip to content

Commit 0b599ba

Browse files
author
Georg Buschbeck
committed
support for 32bit environenments like xtensa, mips ..
1 parent 45c43c9 commit 0b599ba

File tree

4 files changed

+19
-2
lines changed

4 files changed

+19
-2
lines changed

Cargo.toml

+3
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,9 @@ memchr = "^2.3"
3232
reqwest = { version = "^0.12", features = ["blocking"], optional = true }
3333
thiserror = "^1.0"
3434

35+
[target.'cfg(any(target_arch = "powerpc", target_arch = "mips", target_arch = "xtensa"))'.dependencies]
36+
portable-atomic = "1.10.0"
37+
3538
[target.'cfg(target_os = "linux")'.dependencies]
3639
procfs = { version = "^0.16", optional = true, default-features = false }
3740

src/atomic64.rs

+5
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,13 @@
44
use std::cmp::*;
55
use std::f64;
66
use std::ops::*;
7+
#[cfg(not(any(target_arch = "mips", target_arch = "powerpc", target_arch = "xtensa")))]
78
use std::sync::atomic::{AtomicI64 as StdAtomicI64, AtomicU64 as StdAtomicU64, Ordering};
89

10+
#[cfg(any(target_arch = "mips", target_arch = "powerpc", target_arch = "xtensa"))]
11+
use portable_atomic::{AtomicI64 as StdAtomicI64, AtomicU64 as StdAtomicU64, Ordering};
12+
13+
914
/// An interface for numbers. Used to generically model float metrics and integer metrics, i.e.
1015
/// [`Counter`](crate::Counter) and [`IntCounter`](crate::Counter).
1116
pub trait Number:

src/histogram.rs

+6-1
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,15 @@ use std::cell::RefCell;
55
use std::collections::HashMap;
66
use std::convert::From;
77
use std::sync::{
8-
atomic::{AtomicU64 as StdAtomicU64, Ordering},
98
Arc, Mutex,
109
};
10+
11+
#[cfg(not(any(target_arch = "mips", target_arch = "powerpc", target_arch = "xtensa")))]
12+
use std::sync::atomic::{AtomicU64 as StdAtomicU64, Ordering};
13+
1114
use std::time::{Duration, Instant as StdInstant};
15+
#[cfg(any(target_arch = "mips", target_arch = "powerpc", target_arch = "xtensa"))]
16+
use portable_atomic::{AtomicU64 as StdAtomicU64, Ordering};
1217

1318
use crate::atomic64::{Atomic, AtomicF64, AtomicU64};
1419
use crate::desc::{Desc, Describer};

src/timer.rs

+5-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
1-
use std::sync::atomic::{AtomicBool, AtomicU64, Ordering};
1+
#[cfg(not(any(target_arch = "mips", target_arch = "powerpc", target_arch = "xtensa")))]
2+
use std::sync::atomic::{AtomicBool,AtomicU64, Ordering};
3+
#[cfg(any(target_arch = "mips", target_arch = "powerpc", target_arch = "xtensa"))]
4+
use portable_atomic::{AtomicBool,AtomicU64, Ordering};
5+
26
use std::thread;
37
use std::time::{Duration, Instant};
48

0 commit comments

Comments
 (0)