Skip to content

Commit 66e3f31

Browse files
Aaron Kushnermeta-codesync[bot]
authored andcommitted
Add --detailed-read-stats flag
Summary: The filesystem traversal benchmark needed better diagnostics to identify performance bottlenecks in Eden and understand file access patterns. Without detailed breakdowns, it was difficult to determine whether slowness was due to small file overhead, large file I/O, or specific directory hotspots. This adds a --detailed-read-stats flag that provides: - File size distribution across 7 buckets (<1KB to >100MB) - Small/medium/large file performance breakdown (10KB and 1MB thresholds) - Per-category metrics showing time spent in open() vs read() - Top 20 slowest directories with throughput analysis - Directory depth distribution relative to traversal base paths Key design decisions: - Enum-indexed arrays for file categories ensure type safety - Paths displayed relative to --dir arguments for cleaner output - Lock-free atomics for thread-safe concurrent statistics updates - Memory overhead: ~8 KB for histograms + unbounded HashMap for per-directory stats Reviewed By: muirdm Differential Revision: D84996648 fbshipit-source-id: ced2b9e151002719a5c3b20b1d104ccf335d788f
1 parent ff1dfff commit 66e3f31

2 files changed

Lines changed: 468 additions & 11 deletions

File tree

eden/fs/cli_rs/edenfs-commands/src/debug/bench/cmd.rs

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,14 @@ pub enum BenchCmd {
117117
long_help = "Skip the file reading benchmark and only measure directory traversal performance. Useful for testing pure filesystem traversal speed without I/O overhead."
118118
)]
119119
skip_read: bool,
120+
121+
/// Show detailed read statistics including file size distribution and per-directory analysis
122+
#[clap(
123+
long,
124+
help = "Show detailed read performance statistics",
125+
long_help = "Enable detailed read statistics showing file size distribution, per-directory I/O performance breakdown, depth analysis, and file category overhead metrics. Only available when file reading is enabled (not compatible with --skip-read)."
126+
)]
127+
detailed_read_stats: bool,
120128
},
121129
}
122130

@@ -196,7 +204,18 @@ impl crate::Subcommand for BenchCmd {
196204
resource_usage,
197205
json,
198206
skip_read,
207+
detailed_read_stats,
199208
} => {
209+
// Validate flag compatibility
210+
if *skip_read && *detailed_read_stats {
211+
return Err(anyhow::anyhow!(
212+
"--skip-read and --detailed-read-stats are mutually exclusive.\n\
213+
Detailed read statistics focus on file I/O performance metrics which are not \
214+
collected when skipping file reads. Use --detailed-read-stats without --skip-read \
215+
to see I/O performance analysis."
216+
));
217+
}
218+
200219
if !*json {
201220
if dir.len() == 1 {
202221
println!(
@@ -223,6 +242,7 @@ impl crate::Subcommand for BenchCmd {
223242
*resource_usage,
224243
*skip_read,
225244
thrift_io.as_deref(),
245+
*detailed_read_stats,
226246
)
227247
.await?;
228248

0 commit comments

Comments
 (0)