History

[pack-gen] better progress

Sebastian Thiel committed 5 years ago

Commit fdee3811 parent 5b89a0e1 file · +6 −2Browse files

Unified · Split

gitoxide-core/src/pack/create.rs+6−2
@@ -3,6 +3,7 @@ use git_features::progress::Progress; · 2 unmodified lines
33 use git_hash::ObjectId;
44 use git_object::bstr::ByteVec;
55 use git_odb::{linked, pack, FindExt};
6+use std::time::Instant;
67 use std::{ffi::OsStr, io, path::Path, str::FromStr, sync::Arc};
78
89 pub const PROGRESS_RANGE: std::ops::RangeInclusive<u8> = 1..=2;
@@ -94,9 +95,10 @@ pub fn create( · 85 unmodified lines
9495
9596 let chunk_size = 200;
9697 progress.init(Some(3), git_features::progress::steps());
97− let mut count_progress = progress.add_child("counting");
98− count_progress.init(None, git_features::progress::count("objects"));
98+ let start = Instant::now();
9999 let counts = {
100+ let mut count_progress = progress.add_child("counting");
101+ count_progress.init(None, git_features::progress::count("objects"));
100102 let counts_iter = pack::data::output::count_objects_iter(
101103 Arc::clone(&db),
102104 pack::cache::lru::StaticLinkedList::<64>::default,
@@ -117,8 +119,10 @@ pub fn create( · 14 unmodified lines
117119 count_progress.inc_by(c.len());
118120 counts.extend(c.into_iter());
119121 }
122+ count_progress.show_throughput(start);
120123 counts
121124 };
125+
122126 progress.inc();
123127 let num_objects = counts.len();
124128 let entries = pack::data::output::objects_to_entries_iter(