mirror of
https://github.com/hl-archive-node/nanoreth.git
synced 2025-12-06 19:09:54 +00:00
feat: record save_cache duration metrics (#14281)
This commit is contained in:
@ -72,7 +72,6 @@ pub(crate) struct BlockValidationMetrics {
|
||||
/// Prewarm spawn duration
|
||||
pub(crate) prewarm_spawn_duration: Gauge,
|
||||
/// Cache saving duration
|
||||
#[allow(dead_code)]
|
||||
pub(crate) cache_saving_duration: Gauge,
|
||||
/// State root config creation duration
|
||||
pub(crate) state_root_config_duration: Gauge,
|
||||
|
||||
@ -2601,6 +2601,7 @@ where
|
||||
debug!(target: "engine::tree", ?root_elapsed, block=?block_num_hash, "Calculated state root");
|
||||
|
||||
if self.config.use_caching_and_prewarming() {
|
||||
let save_cache_start = Instant::now();
|
||||
// this is the only place / thread a writer is acquired, so we would have already
|
||||
// crashed if we had a poisoned rwlock
|
||||
//
|
||||
@ -2611,6 +2612,10 @@ where
|
||||
// apply state updates to cache and save it (if saving was successful)
|
||||
self.most_recent_cache =
|
||||
state_provider.save_cache(sealed_block.hash(), &output.state).ok();
|
||||
let elapsed = save_cache_start.elapsed();
|
||||
|
||||
// record how long it took to save caches
|
||||
self.metrics.block_validation.cache_saving_duration.set(elapsed.as_secs_f64());
|
||||
}
|
||||
|
||||
let executed: ExecutedBlockWithTrieUpdates<N> = ExecutedBlockWithTrieUpdates {
|
||||
|
||||
Reference in New Issue
Block a user