Add metric for reward cache build time

This commit is contained in:
Michael Sproul
2022-03-29 16:37:30 +11:00
parent c08e26803c
commit 9ab7c24e5a
2 changed files with 6 additions and 0 deletions

View File

@@ -303,9 +303,11 @@ impl<T: EthSpec> OperationPool<T> {
.map_err(OpPoolError::GetAttestationsTotalBalanceError)?;
// Update the reward cache.
let reward_timer = metrics::start_timer(&metrics::BUILD_REWARD_CACHE_TIME);
let mut reward_cache = self.reward_cache.write();
reward_cache.update(state)?;
let reward_cache = RwLockWriteGuard::downgrade(reward_cache);
drop(reward_timer);
// Split attestations for the previous & current epochs, so that we
// can optimise them individually in parallel.

View File

@@ -3,6 +3,10 @@ use lazy_static::lazy_static;
pub use lighthouse_metrics::*;
lazy_static! {
pub static ref BUILD_REWARD_CACHE_TIME: Result<Histogram> = try_create_histogram(
"op_pool_build_reward_cache_time",
"Time to build the reward cache before packing attestations"
);
pub static ref ATTESTATION_PREV_EPOCH_PACKING_TIME: Result<Histogram> = try_create_histogram(
"op_pool_attestation_prev_epoch_packing_time",
"Time to pack previous epoch attestations"