diff options
| author | tv <tv@krebsco.de> | 2026-10-25 13:07:48 +0100 |
|---|---|---|
| committer | tv <tv@krebsco.de> | 2026-10-25 13:07:48 +0100 |
| commit | 3af7c116d41c06822006fb447211e3792862fd7c (patch) | |
| tree | 52b9cdc0630fbd7b811e6b6e20a1f61624806ee8 /src/main.rs | |
| parent | d6620dc266b593e9ed269bcb7e65d3d8c9710d27 (diff) | |
add disk I/O stats
Diffstat (limited to 'src/main.rs')
| -rw-r--r-- | src/main.rs | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/src/main.rs b/src/main.rs index d6773eb..57c26b5 100644 --- a/src/main.rs +++ b/src/main.rs @@ -120,9 +120,14 @@ async fn main() -> Result<()> { Some(path) => Some(bootstrap::load_backup(path)?), None => None, }; - let (initial_doc, recovered_epoch, recovered_swarm) = match recovered { - Some((doc, epoch, swarm_id)) => (doc, Some(epoch), Some(swarm_id)), - None => (AutoCommit::new(), None, None), + let (initial_doc, recovered_epoch, recovered_swarm, backup_bytes) = match recovered { + Some(backup) => ( + backup.doc, + Some(backup.epoch), + Some(backup.swarm_id), + Some(backup.bytes), + ), + None => (AutoCommit::new(), None, None, None), }; let initial_epoch = match (recovered_epoch, args.debug_epoch) { (Some(epoch), _) => epoch, @@ -188,6 +193,14 @@ async fn main() -> Result<()> { trace!("Application state initialized"); + // Files read before the state existed. + let read = backup_bytes + .into_iter() + .chain(state.state_file.as_ref().and_then(|file| file.read_bytes())); + for bytes in read { + state.stats.disk_read(bytes); + } + // Join the remembered swarm and no other; HELLOs claim it. A backup to recover from // names its swarm itself, which wins. let start = match recovered_swarm { |
