Skip to content

Commit

Permalink
Shims remaining AtomicU64 usage (#313)
Browse files Browse the repository at this point in the history
  • Loading branch information
huntc authored Jul 20, 2022
1 parent 12a1014 commit 6f043e8
Show file tree
Hide file tree
Showing 10 changed files with 13 additions and 12 deletions.
2 changes: 1 addition & 1 deletion metrics-benchmark/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,6 @@ pretty_env_logger = "0.4"
getopts = "0.2"
hdrhistogram = { version = "7.2", default-features = false }
quanta = "0.10.0"
atomic-shim = "0.2"
portable-atomic = "0.3"
metrics = { version = "^0.19", path = "../metrics" }
metrics-util = { version = "^0.13", path = "../metrics-util" }
2 changes: 1 addition & 1 deletion metrics-benchmark/src/main.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
use atomic_shim::AtomicU64;
use getopts::Options;
use hdrhistogram::Histogram as HdrHistogram;
use log::{error, info};
Expand All @@ -7,6 +6,7 @@ use metrics::{
Counter, Gauge, Histogram, Key, KeyName, Recorder, SharedString, Unit,
};
use metrics_util::registry::{AtomicStorage, Registry};
use portable_atomic::AtomicU64;
use quanta::{Clock, Instant as QuantaInstant};
use std::{
env,
Expand Down
1 change: 1 addition & 0 deletions metrics-exporter-prometheus/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ parking_lot = { version = "0.11", default-features = false }
thiserror = { version = "1", default-features = false }
quanta = { version = "0.10.0", default-features = false }
indexmap = { version = "1", default-features = false }
portable-atomic = "0.3"

# Optional
hyper = { version = "0.14", default-features = false, features = ["tcp", "http1"], optional = true }
Expand Down
2 changes: 1 addition & 1 deletion metrics-exporter-prometheus/src/registry.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use std::sync::atomic::AtomicU64;
use portable_atomic::AtomicU64;
use std::sync::Arc;

use metrics::HistogramFn;
Expand Down
4 changes: 2 additions & 2 deletions metrics-util/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ required-features = ["handles"]
metrics = { version = "^0.19", path = "../metrics" }
crossbeam-epoch = { version = "0.9.2", default-features = false, optional = true, features = ["alloc", "std"] }
crossbeam-utils = { version = "0.8", default-features = false, optional = true }
atomic-shim = { version = "0.2", default-features = false, optional = true }
portable-atomic = { version = "0.3", optional = true }
aho-corasick = { version = "0.7", default-features = false, optional = true, features = ["std"] }
indexmap = { version = "1", default-features = false, optional = true }
parking_lot = { version = "0.11", default-features = false, optional = true }
Expand Down Expand Up @@ -90,4 +90,4 @@ layer-filter = ["aho-corasick"]
layer-router = ["radix_trie"]
summary = ["sketches-ddsketch"]
recency = ["parking_lot", "registry", "quanta"]
registry = ["atomic-shim", "crossbeam-epoch", "crossbeam-utils", "handles", "hashbrown", "num_cpus", "parking_lot"]
registry = ["portable-atomic", "crossbeam-epoch", "crossbeam-utils", "handles", "hashbrown", "num_cpus", "parking_lot"]
2 changes: 1 addition & 1 deletion metrics-util/src/registry/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -393,8 +393,8 @@ where

#[cfg(test)]
mod tests {
use atomic_shim::AtomicU64;
use metrics::{CounterFn, Key};
use portable_atomic::AtomicU64;

use super::Registry;
use std::sync::{atomic::Ordering, Arc};
Expand Down
2 changes: 1 addition & 1 deletion metrics-util/src/registry/storage.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use std::sync::Arc;

use atomic_shim::AtomicU64;
use metrics::{CounterFn, GaugeFn, HistogramFn};
use portable_atomic::AtomicU64;

use crate::AtomicBucket;

Expand Down
1 change: 1 addition & 0 deletions metrics/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ harness = false
[dependencies]
metrics-macros = { version = "^0.5", path = "../metrics-macros" }
ahash = { version = "0.7", default-features = false }
portable-atomic = "0.3"

[dev-dependencies]
log = "0.4"
Expand Down
6 changes: 2 additions & 4 deletions metrics/src/handles.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
use std::sync::{
atomic::{AtomicU64, Ordering},
Arc,
};
use portable_atomic::AtomicU64;
use std::sync::{atomic::Ordering, Arc};

use crate::IntoF64;

Expand Down
3 changes: 2 additions & 1 deletion metrics/src/key.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
use crate::{cow::Cow, IntoLabels, KeyHasher, Label, SharedString};
use alloc::{string::String, vec::Vec};
use core::{fmt, hash::Hash, slice::Iter};
use portable_atomic::AtomicU64;
use std::{
cmp,
hash::Hasher,
sync::atomic::{AtomicBool, AtomicU64, Ordering},
sync::atomic::{AtomicBool, Ordering},
};

const NO_LABELS: [Label; 0] = [];
Expand Down

0 comments on commit 6f043e8

Please sign in to comment.