Skip to content

Commit

Permalink
Add ProgramCacheUs to execute timings (#473)
Browse files Browse the repository at this point in the history
  • Loading branch information
apfitzge authored Apr 2, 2024
1 parent e815925 commit 65f54be
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
8 changes: 8 additions & 0 deletions program-runtime/src/timings.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ pub enum ExecuteTimingType {
CollectLogsUs,
TotalBatchesLen,
UpdateTransactionStatuses,
ProgramCacheUs,
}

pub struct Metrics([u64; ExecuteTimingType::CARDINALITY]);
Expand Down Expand Up @@ -94,6 +95,13 @@ eager_macro_rules! { $eager_1
.index(ExecuteTimingType::CheckUs),
i64
),
(
"program_cache_us",
*$self
.metrics
.index(ExecuteTimingType::ProgramCacheUs),
i64
),
(
"load_us",
*$self
Expand Down
6 changes: 6 additions & 0 deletions svm/src/transaction_processor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,7 @@ impl<FG: ForkGraph> TransactionBatchProcessor<FG> {
log_messages_bytes_limit: Option<usize>,
limit_to_load_programs: bool,
) -> LoadAndExecuteSanitizedTransactionsOutput {
let mut program_cache_time = Measure::start("program_cache");
let mut program_accounts_map = Self::filter_executable_program_accounts(
callbacks,
sanitized_txs,
Expand All @@ -234,6 +235,7 @@ impl<FG: ForkGraph> TransactionBatchProcessor<FG> {
execution_results: vec![],
};
}
program_cache_time.stop();

let mut load_time = Measure::start("accounts_load");
let mut loaded_transactions = load_accounts(
Expand Down Expand Up @@ -328,6 +330,10 @@ impl<FG: ForkGraph> TransactionBatchProcessor<FG> {
sanitized_txs.len(),
);

timings.saturating_add_in_place(
ExecuteTimingType::ProgramCacheUs,
program_cache_time.as_us(),
);
timings.saturating_add_in_place(ExecuteTimingType::LoadUs, load_time.as_us());
timings.saturating_add_in_place(ExecuteTimingType::ExecuteUs, execution_time.as_us());

Expand Down

0 comments on commit 65f54be

Please sign in to comment.