Skip to content

Commit

Permalink
make that lazy
Browse files Browse the repository at this point in the history
  • Loading branch information
brayniac committed Oct 11, 2023
1 parent c18a3a2 commit 0b2bbe2
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ momento = "0.31.0"
metriken = { git = "https://github.com/brayniac/rustcommon", branch = "metriken-histograms" }
mio = "0.8.8"
net = { git = "https://github.com/pelikan-io/pelikan" }
once_cell = "1.18.0"
paste = "1.0.14"
protocol-memcache = { git = "https://github.com/pelikan-io/pelikan" }
protocol-ping = { git = "https://github.com/pelikan-io/pelikan" }
Expand Down
7 changes: 5 additions & 2 deletions src/main.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
use once_cell::sync::Lazy;
use crate::clients::launch_clients;
use crate::pubsub::launch_pubsub;
use crate::workload::{launch_workload, Generator};
Expand Down Expand Up @@ -30,10 +31,12 @@ use metrics::*;
type Instant = clocksource::Instant<clocksource::Nanoseconds<u64>>;
type UnixInstant = clocksource::UnixInstant<clocksource::Nanoseconds<u64>>;

type HistogramSnapshots = HashMap<Histograms, metriken::histogram::Snapshot>;

static RUNNING: AtomicBool = AtomicBool::new(true);

static SNAPSHOTS: Arc<RwLock<VecDeque<HashMap<Histograms, metriken::histogram::Snapshot>>>> =
Arc::new(RwLock::new(VecDeque::new()));
static SNAPSHOTS: Lazy<Arc<RwLock<VecDeque<HistogramSnapshots>>>> =
Lazy::new(|| Arc::new(RwLock::new(VecDeque::new())));

fn main() {
// custom panic hook to terminate whole process after unwinding
Expand Down

0 comments on commit 0b2bbe2

Please sign in to comment.