ledger tool verify launches system monitor to report mem (#21265)

This commit is contained in:
Jeff Washington (jwash) 2021-11-15 09:29:30 -06:00 committed by GitHub
parent f707dac358
commit a043b19988
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 11 additions and 1 deletions

View File

@ -15,6 +15,7 @@ use solana_clap_utils::{
is_parsable, is_pow2, is_pubkey, is_pubkey_or_keypair, is_slot, is_valid_percentage, is_parsable, is_pow2, is_pubkey, is_pubkey_or_keypair, is_slot, is_valid_percentage,
}, },
}; };
use solana_core::system_monitor_service::SystemMonitorService;
use solana_entry::entry::Entry; use solana_entry::entry::Entry;
use solana_ledger::{ use solana_ledger::{
ancestor_iterator::AncestorIterator, ancestor_iterator::AncestorIterator,
@ -68,7 +69,11 @@ use std::{
path::{Path, PathBuf}, path::{Path, PathBuf},
process::{exit, Command, Stdio}, process::{exit, Command, Stdio},
str::FromStr, str::FromStr,
sync::{mpsc::channel, Arc, RwLock}, sync::{
atomic::{AtomicBool, Ordering},
mpsc::channel,
Arc, RwLock,
},
}; };
mod bigtable; mod bigtable;
@ -1976,6 +1981,9 @@ fn main() {
accounts_index_config.bins = Some(bins); accounts_index_config.bins = Some(bins);
} }
let exit_signal = Arc::new(AtomicBool::new(false));
let system_monitor_service = SystemMonitorService::new(Arc::clone(&exit_signal));
if let Some(limit) = value_t!(arg_matches, "accounts_index_memory_limit_mb", usize).ok() if let Some(limit) = value_t!(arg_matches, "accounts_index_memory_limit_mb", usize).ok()
{ {
accounts_index_config.index_limit_mb = Some(limit); accounts_index_config.index_limit_mb = Some(limit);
@ -2051,6 +2059,8 @@ fn main() {
let working_bank = bank_forks.working_bank(); let working_bank = bank_forks.working_bank();
working_bank.print_accounts_stats(); working_bank.print_accounts_stats();
} }
exit_signal.store(true, Ordering::Relaxed);
system_monitor_service.join().unwrap();
println!("Ok"); println!("Ok");
} }
("graph", Some(arg_matches)) => { ("graph", Some(arg_matches)) => {