Skip to content

Commit c686f08

Browse files
apollo_network_benchmark: add seconds_since_epoch helper function
1 parent 8cd5e64 commit c686f08

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;
@@ -80,6 +80,11 @@ pub fn get_throughput(message_size_bytes: usize, heartbeat_duration: Duration) -
8080
tps * message_size_bytes.into_f64()
8181
}
8282

83+
pub fn seconds_since_epoch() -> u64 {
84+
let now = SystemTime::now();
85+
now.duration_since(UNIX_EPOCH).unwrap().as_secs()
86+
}
87+
8388
/// Creates barebones network metrics
8489
pub fn create_network_metrics() -> apollo_network::metrics::NetworkMetrics {
8590
// Create broadcast metrics for the stress test topic

0 commit comments

Comments
 (0)