@@ -12,8 +12,11 @@ use anyhow::Context as _;
1212use chrono:: DateTime ;
1313use clap:: Subcommand ;
1414use human_repr:: HumanCount ;
15- use std:: path:: { Path , PathBuf } ;
16- use std:: time:: Duration ;
15+ use num:: Zero as _;
16+ use std:: {
17+ path:: { Path , PathBuf } ,
18+ time:: { Duration , Instant } ,
19+ } ;
1720use tokio:: io:: AsyncWriteExt ;
1821
1922#[ derive( Debug , Subcommand ) ]
@@ -92,11 +95,12 @@ impl SnapshotCommands {
9295 } ;
9396
9497 let handle = tokio:: spawn ( {
98+ let start = Instant :: now ( ) ;
9599 let tmp_file = temp_path. to_owned ( ) ;
96100 let output_path = output_path. clone ( ) ;
97101 async move {
98102 let mut interval =
99- tokio:: time:: interval ( tokio:: time:: Duration :: from_secs_f32 ( 0.25 ) ) ;
103+ tokio:: time:: interval ( tokio:: time:: Duration :: from_secs_f32 ( 0.5 ) ) ;
100104 println ! ( "Getting ready to export..." ) ;
101105 loop {
102106 interval. tick ( ) . await ;
@@ -108,10 +112,17 @@ impl SnapshotCommands {
108112 anes:: MoveCursorToPreviousLine ( 1 ) ,
109113 anes:: ClearLine :: All
110114 ) ;
115+ let elapsed_secs = start. elapsed ( ) . as_secs_f64 ( ) ;
111116 println ! (
112- "{}: {}" ,
117+ "{}: {} ({}/s) " ,
113118 & output_path. to_string_lossy( ) ,
114- snapshot_size. human_count_bytes( )
119+ snapshot_size. human_count_bytes( ) ,
120+ if elapsed_secs. is_zero( ) {
121+ 0.
122+ } else {
123+ ( snapshot_size as f64 ) / elapsed_secs
124+ }
125+ . human_count_bytes( ) ,
115126 ) ;
116127 let _ = std:: io:: stdout ( ) . flush ( ) ;
117128 }
0 commit comments