diff --git a/src/metrics/counter.rs b/src/metrics/counter.rs index c1c5e511..4338c2d5 100644 --- a/src/metrics/counter.rs +++ b/src/metrics/counter.rs @@ -6,7 +6,7 @@ use crate::encoding::{EncodeMetric, MetricEncoder}; use super::{MetricType, TypedMetric}; use std::marker::PhantomData; -#[cfg(not(any(target_arch = "mips", target_arch = "powerpc")))] +#[cfg(not(any(target_arch = "mips", target_arch = "powerpc", target_arch = "riscv32")))] use std::sync::atomic::AtomicU64; use std::sync::atomic::{AtomicU32, Ordering}; use std::sync::Arc; @@ -40,7 +40,7 @@ use std::sync::Arc; /// counter.inc(); /// let _value: f64 = counter.get(); /// ``` -#[cfg(not(any(target_arch = "mips", target_arch = "powerpc")))] +#[cfg(not(any(target_arch = "mips", target_arch = "powerpc", target_arch = "riscv32")))] #[derive(Debug)] pub struct Counter { value: Arc, @@ -48,7 +48,7 @@ pub struct Counter { } /// Open Metrics [`Counter`] to measure discrete events. -#[cfg(any(target_arch = "mips", target_arch = "powerpc"))] +#[cfg(any(target_arch = "mips", target_arch = "powerpc", target_arch = "riscv32"))] #[derive(Debug)] pub struct Counter { value: Arc, @@ -114,7 +114,7 @@ pub trait Atomic { fn get(&self) -> N; } -#[cfg(not(any(target_arch = "mips", target_arch = "powerpc")))] +#[cfg(not(any(target_arch = "mips", target_arch = "powerpc", target_arch = "riscv32")))] impl Atomic for AtomicU64 { fn inc(&self) -> u64 { self.inc_by(1) @@ -143,7 +143,7 @@ impl Atomic for AtomicU32 { } } -#[cfg(not(any(target_arch = "mips", target_arch = "powerpc")))] +#[cfg(not(any(target_arch = "mips", target_arch = "powerpc", target_arch = "riscv32")))] impl Atomic for AtomicU64 { fn inc(&self) -> f64 { self.inc_by(1.0) @@ -231,7 +231,7 @@ mod tests { assert_eq!(1, counter.get()); } - #[cfg(not(any(target_arch = "mips", target_arch = "powerpc")))] + #[cfg(not(any(target_arch = "mips", target_arch = "powerpc", target_arch = "riscv32")))] #[test] fn f64_stored_in_atomic_u64() { fn prop(fs: Vec) { diff --git a/src/metrics/exemplar.rs b/src/metrics/exemplar.rs index c8478c6a..95c309b3 100644 --- a/src/metrics/exemplar.rs +++ b/src/metrics/exemplar.rs @@ -11,9 +11,9 @@ use super::histogram::Histogram; use super::{MetricType, TypedMetric}; use parking_lot::{MappedRwLockReadGuard, RwLock, RwLockReadGuard}; use std::collections::HashMap; -#[cfg(any(target_arch = "mips", target_arch = "powerpc"))] +#[cfg(any(target_arch = "mips", target_arch = "powerpc", target_arch = "riscv32"))] use std::sync::atomic::AtomicU32; -#[cfg(not(any(target_arch = "mips", target_arch = "powerpc")))] +#[cfg(not(any(target_arch = "mips", target_arch = "powerpc", target_arch = "riscv32")))] use std::sync::atomic::AtomicU64; use std::sync::Arc; @@ -65,7 +65,7 @@ pub struct Exemplar { /// }), /// ); /// ``` -#[cfg(not(any(target_arch = "mips", target_arch = "powerpc")))] +#[cfg(not(any(target_arch = "mips", target_arch = "powerpc", target_arch = "riscv32")))] #[derive(Debug)] pub struct CounterWithExemplar { pub(crate) inner: Arc>>, @@ -77,7 +77,7 @@ impl TypedMetric for CounterWithExemplar { /// Open Metrics [`Counter`] with an [`Exemplar`] to both measure discrete /// events and track references to data outside of the metric set. -#[cfg(any(target_arch = "mips", target_arch = "powerpc"))] +#[cfg(any(target_arch = "mips", target_arch = "powerpc", target_arch = "riscv32"))] #[derive(Debug)] pub struct CounterWithExemplar { pub(crate) inner: Arc>>, diff --git a/src/metrics/gauge.rs b/src/metrics/gauge.rs index 7b268427..5814a846 100644 --- a/src/metrics/gauge.rs +++ b/src/metrics/gauge.rs @@ -7,7 +7,7 @@ use crate::encoding::{EncodeGaugeValue, EncodeMetric, MetricEncoder}; use super::{MetricType, TypedMetric}; use std::marker::PhantomData; use std::sync::atomic::{AtomicI32, AtomicU32, Ordering}; -#[cfg(not(any(target_arch = "mips", target_arch = "powerpc")))] +#[cfg(not(any(target_arch = "mips", target_arch = "powerpc", target_arch = "riscv32")))] use std::sync::atomic::{AtomicI64, AtomicU64}; use std::sync::Arc; @@ -40,7 +40,7 @@ use std::sync::Arc; /// gauge.set(42.0); /// let _value: f64 = gauge.get(); /// ``` -#[cfg(not(any(target_arch = "mips", target_arch = "powerpc")))] +#[cfg(not(any(target_arch = "mips", target_arch = "powerpc", target_arch = "riscv32")))] #[derive(Debug)] pub struct Gauge { value: Arc, @@ -48,7 +48,7 @@ pub struct Gauge { } /// Open Metrics [`Gauge`] to record current measurements. -#[cfg(any(target_arch = "mips", target_arch = "powerpc"))] +#[cfg(any(target_arch = "mips", target_arch = "powerpc", target_arch = "riscv32"))] #[derive(Debug)] pub struct Gauge { value: Arc, @@ -186,7 +186,7 @@ impl Atomic for AtomicU32 { } } -#[cfg(not(any(target_arch = "mips", target_arch = "powerpc")))] +#[cfg(not(any(target_arch = "mips", target_arch = "powerpc", target_arch = "riscv32")))] impl Atomic for AtomicI64 { fn inc(&self) -> i64 { self.inc_by(1) @@ -213,7 +213,7 @@ impl Atomic for AtomicI64 { } } -#[cfg(not(any(target_arch = "mips", target_arch = "powerpc")))] +#[cfg(not(any(target_arch = "mips", target_arch = "powerpc", target_arch = "riscv32")))] impl Atomic for AtomicU64 { fn inc(&self) -> f64 { self.inc_by(1.0)