@@ -22,14 +22,18 @@ pub struct EntryData {
2222}
2323
2424/// The result of the previous filesystem traversal
25- #[ derive( Default , Debug ) ]
25+ #[ derive( Debug ) ]
2626pub struct Traversal {
2727 /// A tree representing the entire filestem traversal
2828 pub tree : Tree ,
2929 /// The top-level node of the tree.
3030 pub root_index : TreeIndex ,
3131 /// Amount of files or directories we have seen during the filesystem traversal
3232 pub entries_traversed : u64 ,
33+ /// The time at which the traversal started.
34+ pub start : std:: time:: Instant ,
35+ /// The amount of time it took to finish the traversal. Set only once done.
36+ pub elapsed : Option < std:: time:: Duration > ,
3337 /// Total amount of IO errors encountered when traversing the filesystem
3438 pub io_errors : u64 ,
3539 /// Total amount of bytes seen during the traversal
@@ -62,7 +66,11 @@ impl Traversal {
6266 Traversal {
6367 tree,
6468 root_index,
65- ..Default :: default ( )
69+ entries_traversed : 0 ,
70+ start : std:: time:: Instant :: now ( ) ,
71+ elapsed : None ,
72+ io_errors : 0 ,
73+ total_bytes : None ,
6674 }
6775 } ;
6876
@@ -201,6 +209,7 @@ impl Traversal {
201209 set_size_or_panic ( & mut t. tree , t. root_index , root_size) ;
202210 t. total_bytes = Some ( root_size) ;
203211
212+ t. elapsed = Some ( t. start . elapsed ( ) ) ;
204213 Ok ( Some ( t) )
205214 }
206215
0 commit comments