Humanize the 'ledger processed...' time

This commit is contained in:
Michael Vines 2021-01-08 20:36:22 -08:00
parent 0d8acd1f79
commit 86c81a0ba2
3 changed files with 5 additions and 3 deletions

1
Cargo.lock generated
View File

@ -4328,6 +4328,7 @@ dependencies = [
"bincode", "bincode",
"byteorder", "byteorder",
"chrono", "chrono",
"chrono-humanize",
"crossbeam-channel", "crossbeam-channel",
"dlopen", "dlopen",
"dlopen_derive", "dlopen_derive",

View File

@ -12,6 +12,7 @@ edition = "2018"
bincode = "1.3.1" bincode = "1.3.1"
byteorder = "1.3.4" byteorder = "1.3.4"
chrono = { version = "0.4.11", features = ["serde"] } chrono = { version = "0.4.11", features = ["serde"] }
chrono-humanize = "0.1.1"
crossbeam-channel = "0.4" crossbeam-channel = "0.4"
dlopen_derive = "0.1.4" dlopen_derive = "0.1.4"
dlopen = "0.1.8" dlopen = "0.1.8"

View File

@ -6,6 +6,7 @@ use crate::{
entry::{create_ticks, Entry, EntrySlice, EntryVerificationStatus, VerifyRecyclers}, entry::{create_ticks, Entry, EntrySlice, EntryVerificationStatus, VerifyRecyclers},
leader_schedule_cache::LeaderScheduleCache, leader_schedule_cache::LeaderScheduleCache,
}; };
use chrono_humanize::{Accuracy, HumanTime, Tense};
use crossbeam_channel::Sender; use crossbeam_channel::Sender;
use itertools::Itertools; use itertools::Itertools;
use log::*; use log::*;
@ -34,7 +35,6 @@ use solana_sdk::{
hash::Hash, hash::Hash,
pubkey::Pubkey, pubkey::Pubkey,
signature::{Keypair, Signature}, signature::{Keypair, Signature},
timing::duration_as_ms,
transaction::{Result, Transaction, TransactionError}, transaction::{Result, Transaction, TransactionError},
}; };
use solana_transaction_status::token_balances::{ use solana_transaction_status::token_balances::{
@ -479,8 +479,8 @@ fn do_process_blockstore_from_root(
let bank_forks = BankForks::new_from_banks(&initial_forks, root); let bank_forks = BankForks::new_from_banks(&initial_forks, root);
info!( info!(
"ledger processed in {}ms. {} MB allocated. root={}, {} fork{} at {}, with {} frozen bank{}", "ledger processed in {}. {} MB allocated. root slot is {}, {} fork{} at {}, with {} frozen bank{}",
duration_as_ms(&now.elapsed()), HumanTime::from(chrono::Duration::from_std(now.elapsed()).unwrap()).to_text_en(Accuracy::Precise, Tense::Present),
allocated.since(initial_allocation) / 1_000_000, allocated.since(initial_allocation) / 1_000_000,
bank_forks.root(), bank_forks.root(),
initial_forks.len(), initial_forks.len(),