Skip to content

Commit

Permalink
measure_us! use Instant and duration_to_us internally (solana-labs#30339
Browse files Browse the repository at this point in the history
)
  • Loading branch information
apfitzge authored Feb 15, 2023
1 parent eb6d6e9 commit b86bfbb
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 6 deletions.
2 changes: 1 addition & 1 deletion core/src/banking_stage/committer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use {
solana_ledger::{
blockstore_processor::TransactionStatusSender, token_balances::collect_token_balances,
},
solana_measure::{measure, measure_us},
solana_measure::measure_us,
solana_runtime::{
accounts::TransactionLoadResult,
bank::{
Expand Down
2 changes: 1 addition & 1 deletion core/src/banking_stage/packet_receiver.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ use {
unprocessed_transaction_storage::UnprocessedTransactionStorage,
},
crossbeam_channel::RecvTimeoutError,
solana_measure::{measure, measure::Measure, measure_us},
solana_measure::{measure::Measure, measure_us},
solana_sdk::{saturating_add_assign, timing::timestamp},
std::{sync::atomic::Ordering, time::Duration},
};
Expand Down
5 changes: 3 additions & 2 deletions measure/src/macros.rs
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,9 @@ macro_rules! measure {
#[macro_export]
macro_rules! measure_us {
($val:expr) => {{
let (result, measure) = measure!($val);
(result, measure.as_us())
let start = std::time::Instant::now();
let result = $val;
(result, solana_sdk::timing::duration_as_us(&start.elapsed()))
}};
}

Expand Down
2 changes: 1 addition & 1 deletion runtime/src/accounts_db.rs
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ use {
rand::{thread_rng, Rng},
rayon::{prelude::*, ThreadPool},
serde::{Deserialize, Serialize},
solana_measure::{measure, measure::Measure, measure_us},
solana_measure::{measure::Measure, measure_us},
solana_rayon_threadlimit::get_thread_count,
solana_sdk::{
account::{Account, AccountSharedData, ReadableAccount, WritableAccount},
Expand Down
2 changes: 1 addition & 1 deletion runtime/src/ancient_append_vecs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ use {
storable_accounts::{StorableAccounts, StorableAccountsBySlot},
},
rand::{thread_rng, Rng},
solana_measure::{measure, measure_us},
solana_measure::measure_us,
solana_sdk::{account::ReadableAccount, clock::Slot, hash::Hash, saturating_add_assign},
std::{
collections::HashMap,
Expand Down

0 comments on commit b86bfbb

Please sign in to comment.