File tree Expand file tree Collapse file tree 2 files changed +31
-0
lines changed
eden/fs/cli_rs/edenfs-commands/src/debug/bench Expand file tree Collapse file tree 2 files changed +31
-0
lines changed Original file line number Diff line number Diff line change @@ -86,6 +86,10 @@ pub enum BenchCmd {
8686 /// Output results in JSON format
8787 #[ clap( long) ]
8888 json : bool ,
89+
90+ /// Skip the file reading benchmark and display only traversal results
91+ #[ clap( long) ]
92+ skip_read : bool ,
8993 } ,
9094}
9195
@@ -164,6 +168,7 @@ impl crate::Subcommand for BenchCmd {
164168 no_progress,
165169 resource_usage,
166170 json,
171+ skip_read,
167172 } => {
168173 if !* json {
169174 println ! (
@@ -179,6 +184,7 @@ impl crate::Subcommand for BenchCmd {
179184 * follow_symlinks,
180185 * no_progress,
181186 * resource_usage,
187+ * skip_read,
182188 thrift_io. as_deref ( ) ,
183189 )
184190 . await ?
@@ -189,6 +195,7 @@ impl crate::Subcommand for BenchCmd {
189195 * follow_symlinks,
190196 * no_progress,
191197 * resource_usage,
198+ * skip_read,
192199 ) ?
193200 } ;
194201
Original file line number Diff line number Diff line change @@ -251,6 +251,7 @@ pub async fn bench_traversal_thrift_read(
251251 follow_symlinks : bool ,
252252 no_progress : bool ,
253253 resource_usage : bool ,
254+ skip_read : bool ,
254255 fbsource_path : Option < & str > ,
255256) -> Result < Benchmark > {
256257 let path = Path :: new ( dir_path) ;
@@ -314,6 +315,23 @@ pub async fn bench_traversal_thrift_read(
314315 types:: Unit :: Dirs ,
315316 Some ( 0 ) ,
316317 ) ;
318+ result. add_metric (
319+ "Total symlinks skipped" ,
320+ ft. symlink_skipped_count as f64 ,
321+ types:: Unit :: Symlinks ,
322+ Some ( 0 ) ,
323+ ) ;
324+ result. add_metric (
325+ "Total symlinks traversed" ,
326+ ft. symlink_traversed_count as f64 ,
327+ types:: Unit :: Symlinks ,
328+ Some ( 0 ) ,
329+ ) ;
330+
331+ // Return early if skip_read is true
332+ if skip_read {
333+ return Ok ( result) ;
334+ }
317335
318336 let read_progress = if no_progress {
319337 None
@@ -445,6 +463,7 @@ pub fn bench_traversal_fs_read(
445463 follow_symlinks : bool ,
446464 no_progress : bool ,
447465 resource_usage : bool ,
466+ skip_read : bool ,
448467) -> Result < Benchmark > {
449468 let path = Path :: new ( dir_path) ;
450469 if !path. exists ( ) || !path. is_dir ( ) {
@@ -521,6 +540,11 @@ pub fn bench_traversal_fs_read(
521540 Some ( 0 ) ,
522541 ) ;
523542
543+ // Return early if skip_read is true
544+ if skip_read {
545+ return Ok ( result) ;
546+ }
547+
524548 let read_progress = if no_progress {
525549 None
526550 } else {
You can’t perform that action at this time.
0 commit comments