* add --no-os-network-stats-reporting option (#21296)
(cherry picked from commit d5de0c8e12)
# Conflicts:
# core/src/system_monitor_service.rs
# ledger-tool/src/main.rs
# validator/src/main.rs
* resolve merge conflicts
Co-authored-by: Jeff Biseda <jbiseda@gmail.com>
This commit is contained in:
@@ -95,12 +95,12 @@ pub fn verify_udp_stats_access() -> Result<(), String> {
|
||||
}
|
||||
|
||||
impl SystemMonitorService {
|
||||
pub fn new(exit: Arc<AtomicBool>) -> Self {
|
||||
pub fn new(exit: Arc<AtomicBool>, report_os_network_stats: bool) -> Self {
|
||||
info!("Starting SystemMonitorService");
|
||||
let thread_hdl = Builder::new()
|
||||
.name("system-monitor".to_string())
|
||||
.spawn(move || {
|
||||
Self::run(exit);
|
||||
Self::run(exit, report_os_network_stats);
|
||||
})
|
||||
.unwrap();
|
||||
|
||||
@@ -173,21 +173,19 @@ impl SystemMonitorService {
|
||||
);
|
||||
}
|
||||
|
||||
pub fn run(exit: Arc<AtomicBool>) {
|
||||
pub fn run(exit: Arc<AtomicBool>, report_os_network_stats: bool) {
|
||||
let mut udp_stats = None;
|
||||
|
||||
let mut now = Instant::now();
|
||||
loop {
|
||||
if exit.load(Ordering::Relaxed) {
|
||||
break;
|
||||
}
|
||||
|
||||
if now.elapsed() >= SAMPLE_INTERVAL {
|
||||
now = Instant::now();
|
||||
|
||||
SystemMonitorService::process_udp_stats(&mut udp_stats);
|
||||
if report_os_network_stats {
|
||||
SystemMonitorService::process_udp_stats(&mut udp_stats);
|
||||
}
|
||||
}
|
||||
|
||||
sleep(SLEEP_INTERVAL);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user