Skip to content

Commit

Permalink
v1.16: Add metrics for locking the blockhash queue in banking stage (…
Browse files Browse the repository at this point in the history
…backport of solana-labs#34382) (solana-labs#34383)

* Add metrics for locking the blockhash queue in banking stage (solana-labs#34382)

(cherry picked from commit 2971e84)

# Conflicts:
#	core/src/banking_stage/consume_worker.rs

* resolve conflicts

---------

Co-authored-by: Justin Starry <justin.starry@icloud.com>
Co-authored-by: Justin Starry <justin@solana.com>
  • Loading branch information
3 people authored Dec 9, 2023
1 parent 87749a1 commit 85e3058
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 4 deletions.
7 changes: 3 additions & 4 deletions core/src/banking_stage/committer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ use {
transaction_batch::TransactionBatch,
vote_sender_types::ReplayVoteSender,
},
solana_sdk::{pubkey::Pubkey, saturating_add_assign},
solana_sdk::{hash::Hash, pubkey::Pubkey, saturating_add_assign},
solana_transaction_status::{
token_balances::TransactionTokenBalancesSet, TransactionTokenBalance,
},
Expand Down Expand Up @@ -65,6 +65,8 @@ impl Committer {
batch: &TransactionBatch,
loaded_transactions: &mut [TransactionLoadResult],
execution_results: Vec<TransactionExecutionResult>,
last_blockhash: Hash,
lamports_per_signature: u64,
starting_transaction_index: Option<usize>,
bank: &Arc<Bank>,
pre_balance_info: &mut PreBalanceInfo,
Expand All @@ -74,9 +76,6 @@ impl Committer {
executed_non_vote_transactions_count: usize,
executed_with_successful_result_count: usize,
) -> (u64, Vec<CommitTransactionDetails>) {
let (last_blockhash, lamports_per_signature) =
bank.last_blockhash_and_lamports_per_signature();

let executed_transactions = execution_results
.iter()
.zip(batch.sanitized_transactions())
Expand Down
6 changes: 6 additions & 0 deletions core/src/banking_stage/consumer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -586,6 +586,10 @@ impl Consumer {
let (freeze_lock, freeze_lock_us) = measure_us!(bank.freeze_lock());
execute_and_commit_timings.freeze_lock_us = freeze_lock_us;

let ((last_blockhash, lamports_per_signature), last_blockhash_us) =
measure_us!(bank.last_blockhash_and_lamports_per_signature());
execute_and_commit_timings.last_blockhash_us = last_blockhash_us;

let (record_transactions_summary, record_us) = measure_us!(self
.transaction_recorder
.record_transactions(bank.slot(), executed_transactions));
Expand Down Expand Up @@ -622,6 +626,8 @@ impl Consumer {
batch,
&mut loaded_transactions,
execution_results,
last_blockhash,
lamports_per_signature,
starting_transaction_index,
bank,
&mut pre_balance_info,
Expand Down
3 changes: 3 additions & 0 deletions core/src/leader_slot_banking_stage_timing_metrics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ pub struct LeaderExecuteAndCommitTimings {
pub collect_balances_us: u64,
pub load_execute_us: u64,
pub freeze_lock_us: u64,
pub last_blockhash_us: u64,
pub record_us: u64,
pub commit_us: u64,
pub find_and_send_votes_us: u64,
Expand All @@ -22,6 +23,7 @@ impl LeaderExecuteAndCommitTimings {
saturating_add_assign!(self.collect_balances_us, other.collect_balances_us);
saturating_add_assign!(self.load_execute_us, other.load_execute_us);
saturating_add_assign!(self.freeze_lock_us, other.freeze_lock_us);
saturating_add_assign!(self.last_blockhash_us, other.last_blockhash_us);
saturating_add_assign!(self.record_us, other.record_us);
saturating_add_assign!(self.commit_us, other.commit_us);
saturating_add_assign!(self.find_and_send_votes_us, other.find_and_send_votes_us);
Expand All @@ -38,6 +40,7 @@ impl LeaderExecuteAndCommitTimings {
("collect_balances_us", self.collect_balances_us as i64, i64),
("load_execute_us", self.load_execute_us as i64, i64),
("freeze_lock_us", self.freeze_lock_us as i64, i64),
("last_blockhash_us", self.last_blockhash_us as i64, i64),
("record_us", self.record_us as i64, i64),
("commit_us", self.commit_us as i64, i64),
(
Expand Down

0 comments on commit 85e3058

Please sign in to comment.