Skip to content

Commit

Permalink
use blocks intead of batches for info
Browse files Browse the repository at this point in the history
  • Loading branch information
SantiagoPittella committed Jan 30, 2025
1 parent 6b392ba commit 58cac73
Showing 1 changed file with 16 additions and 11 deletions.
27 changes: 16 additions & 11 deletions bin/stress-test/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -221,18 +221,22 @@ fn print_metrics(
}
}

// Print out the store file size every 1k batches to track the growth of the file.
println!("Store file size every 1k batches:");
// Print out the store file size every 50 blocks to track the growth of the file.
println!("Store file size every 50 blocks:");
for (i, size) in store_file_size_over_time.iter().enumerate() {
println!("{}: {} bytes", i * 1000, size);
println!("Block {}: {} bytes", i * 50, size);
}

// Print out the average growth rate of the file
let initial_size = store_file_size_over_time.first().unwrap();
let final_size = store_file_size_over_time.last().unwrap();
let growth_rate = (final_size - initial_size) as f64 / num_insertions as f64;

println!("Average growth rate: {} bytes per batch", growth_rate);
println!("Average growth rate: {} bytes per blocks", growth_rate);

// Print out the avg space used per account
let avg_space_per_account = growth_rate / 255.0;
println!("Average space used per account: {} bytes", avg_space_per_account);
}

/// Create a new faucet account with a given anchor block.
Expand Down Expand Up @@ -317,15 +321,16 @@ async fn build_blocks(
block_builder.build_block(&current_block).await.unwrap();
insertion_time_per_block.push(start.elapsed());
current_block.clear();
}

if counter % 1000 == 0 {
let store_file_size = std::fs::metadata("./miden-store.sqlite3").unwrap().len();
let wal_file_size = std::fs::metadata("./miden-store.sqlite3-wal").unwrap().len();
store_file_sizes.push(store_file_size + wal_file_size);
}
// We track the size of the DB every 50 blocks.
if counter % 50 == 0 {
let store_file_size = std::fs::metadata("./miden-store.sqlite3").unwrap().len();
let wal_file_size = std::fs::metadata("./miden-store.sqlite3-wal").unwrap().len();
store_file_sizes.push(store_file_size + wal_file_size);
}

counter += 1;
counter += 1;
}
}

if !current_block.is_empty() {
Expand Down

0 comments on commit 58cac73

Please sign in to comment.