Skip to content

Commit

Permalink
Make replay_stats locking more granular
Browse files Browse the repository at this point in the history
  • Loading branch information
ryoqun committed Apr 23, 2023
1 parent 16a1e9c commit 3a7810c
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions core/src/replay_stage.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2639,15 +2639,18 @@ impl ReplayStage {
.expect("Bank fork progress entry missing for completed bank");

let replay_stats = bank_progress.replay_stats.clone();
let mut replay_stats = replay_stats.write().unwrap();

if let Some((result, complete_execute_timings)) =
bank.wait_for_completed_scheduler()
{
let metrics = ExecuteBatchesInternalMetrics::new_with_timings_from_all_threads(
complete_execute_timings,
);
replay_stats.batch_execute.accumulate(metrics);
replay_stats
.write()
.unwrap()
.batch_execute
.accumulate(metrics);

if let Err(err) = result {
Self::mark_dead_slot(
Expand All @@ -2670,13 +2673,14 @@ impl ReplayStage {
}
}

let r_replay_stats = replay_stats.read().unwrap();
let replay_progress = bank_progress.replay_progress.clone();
let r_replay_progress = replay_progress.read().unwrap();
debug!(
"bank {} has completed replay from blockstore, \
contribute to update cost with {:?}",
bank.slot(),
replay_stats.batch_execute.totals
r_replay_stats.batch_execute.totals
);
did_complete_bank = true;
let _ = cluster_slots_update_sender.send(vec![bank_slot]);
Expand Down Expand Up @@ -2764,14 +2768,14 @@ impl ReplayStage {
}
bank_complete_time.stop();

replay_stats.report_stats(
r_replay_stats.report_stats(
bank.slot(),
r_replay_progress.num_txs,
r_replay_progress.num_entries,
r_replay_progress.num_shreds,
bank_complete_time.as_us(),
);
execute_timings.accumulate(&replay_stats.batch_execute.totals);
execute_timings.accumulate(&r_replay_stats.batch_execute.totals);
} else {
trace!(
"bank {} not completed tick_height: {}, max_tick_height: {}",
Expand Down

0 comments on commit 3a7810c

Please sign in to comment.