Skip to content

Commit

Permalink
fix: fix for cachedb size (#22)
Browse files Browse the repository at this point in the history
  • Loading branch information
anonymousGiga authored Nov 24, 2023
1 parent 2d6d5b4 commit 1743da4
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 14 deletions.
10 changes: 5 additions & 5 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

19 changes: 10 additions & 9 deletions crates/stages/src/stages/execution.rs
Original file line number Diff line number Diff line change
Expand Up @@ -223,16 +223,11 @@ impl<EF: ExecutorFactory> ExecutionStage<EF> {
#[cfg(feature = "enable_execution_duration_record")]
duration_record.add_process_state_duration();

#[cfg(feature = "enable_cache_record")]
#[cfg(all(feature = "enable_test_max_th", feature = "enable_cache_record"))]
{
let cachedb_size = executor.get_cachedb_size();
if let Some(metrics_tx) = &mut self.metrics_tx {
let _ = metrics_tx
.send(MetricEvent::CacheDbSizeInfo { block_number, cachedb_size });
}

#[cfg(feature = "enable_test_max_th")]
{
// TODO: Need modify later.
if block_number == 500_000 {
let cachedb_size = executor.get_cachedb_size();
println!(
"block_number: {:?}, start_block: {:?}, state.size_hint: {:?}, cache_size: {:?}",
block_number,
Expand All @@ -258,8 +253,14 @@ impl<EF: ExecutorFactory> ExecutionStage<EF> {

#[cfg(feature = "enable_cache_record")]
{
let cachedb_size = executor.get_cachedb_size();
let cachedb_record = executor.get_cachedb_record();
if let Some(metrics_tx) = &mut self.metrics_tx {
// This block_number should be delete latter.
let block_number = 0;
let _ =
metrics_tx.send(MetricEvent::CacheDbSizeInfo { block_number, cachedb_size });

let _ =
metrics_tx.send(MetricEvent::CacheDbInfo { cache_db_record: cachedb_record });
}
Expand Down

0 comments on commit 1743da4

Please sign in to comment.