From 6388c1fb2eb2c077520529b1bf3d6411f373df2b Mon Sep 17 00:00:00 2001 From: "Brian L. Troutwine" Date: Thu, 24 Oct 2024 19:17:07 -0700 Subject: [PATCH] emit total bytes loss logs Signed-off-by: Brian L. Troutwine --- lading/src/generator/file_gen/model.rs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/lading/src/generator/file_gen/model.rs b/lading/src/generator/file_gen/model.rs index 13f676b0d..fae600a6a 100644 --- a/lading/src/generator/file_gen/model.rs +++ b/lading/src/generator/file_gen/model.rs @@ -5,6 +5,7 @@ use std::collections::{HashMap, HashSet}; use bytes::Bytes; use lading_payload::block; use rand::Rng; +use tracing::info; /// Time representation of the model pub type Tick = u64; @@ -675,6 +676,7 @@ impl State { // Garbage collect unlinked files with no open handles, calculating the bytes // lost from these files. + #[tracing::instrument(skip(self))] fn gc(&mut self) { let mut to_remove = Vec::new(); for (&inode, node) in &self.nodes { @@ -688,6 +690,7 @@ impl State { if let Some(Node::File { file }) = self.nodes.remove(&inode) { let lost_bytes = file.bytes_written.saturating_sub(file.bytes_read); self.lost_bytes += lost_bytes; + info!("TOTAL BYTES LOST: {lost}", lost = self.lost_bytes); } } }