Skip to content

Commit 6e7d057

Browse files
apollo_network_benchmark: add seconds_since_epoch helper function
1 parent 5027f26 commit 6e7d057

File tree

1 file changed

+6
-1
lines changed
  • crates/apollo_network_benchmark/src/bin/broadcast_network_stress_test_node

1 file changed

+6
-1
lines changed

crates/apollo_network_benchmark/src/bin/broadcast_network_stress_test_node/metrics.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
use std::collections::HashMap;
2-
use std::time::Duration;
2+
use std::time::{Duration, SystemTime, UNIX_EPOCH};
33

44
use apollo_metrics::define_metrics;
55
use apollo_metrics::metrics::LossyIntoF64;
@@ -67,6 +67,11 @@ pub fn get_throughput(message_size_bytes: usize, heartbeat_duration: Duration) -
6767
tps * message_size_bytes.into_f64()
6868
}
6969

70+
pub fn seconds_since_epoch() -> u64 {
71+
let now = SystemTime::now();
72+
now.duration_since(UNIX_EPOCH).unwrap().as_secs()
73+
}
74+
7075
/// Creates barebones network metrics
7176
pub fn create_network_metrics() -> apollo_network::metrics::NetworkMetrics {
7277
// Create broadcast metrics for the stress test topic

0 commit comments

Comments
 (0)