diff options
author | Eelco Dolstra <edolstra@gmail.com> | 2017-08-14T20·42+0200 |
---|---|---|
committer | Eelco Dolstra <edolstra@gmail.com> | 2017-08-16T18·56+0200 |
commit | bf1f123b09ec7402b0565808619e11b5bfe6b16b (patch) | |
tree | d0e4c9af039b8bf05244f648907c21274ee37054 /src/nix/progress-bar.cc | |
parent | 0e0dcf2c7ec054f1b30629e275f53f56039b8257 (diff) |
Progress indicator: Show number of active items
Diffstat (limited to 'src/nix/progress-bar.cc')
-rw-r--r-- | src/nix/progress-bar.cc | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/src/nix/progress-bar.cc b/src/nix/progress-bar.cc index 21d89e47709e..f4fc79fca160 100644 --- a/src/nix/progress-bar.cc +++ b/src/nix/progress-bar.cc @@ -22,6 +22,7 @@ private: ActivityType type = actUnknown; uint64_t done = 0; uint64_t expected = 0; + uint64_t running = 0; std::map<ActivityType, uint64_t> expectedByType; }; @@ -174,19 +175,20 @@ public: auto showActivity = [&](ActivityType type, const std::string & f, double unit) { auto & act = state.activitiesByType[type]; - uint64_t done = act.done, expected = act.done; + uint64_t done = act.done, expected = act.done, running = 0; for (auto & j : act.its) { done += j.second->done; expected += j.second->expected; + running += j.second->running; } expected = std::max(expected, act.expected); if (done || expected) - add(fmt(f, done / unit, expected / unit)); + add(fmt(f, done / unit, expected / unit, running)); }; - showActivity(actCopyPaths, ANSI_GREEN "%d" ANSI_NORMAL "/%d copied", 1); + showActivity(actCopyPaths, ANSI_BLUE "%3$d" ANSI_NORMAL "/" ANSI_GREEN "%1$d" ANSI_NORMAL "/%2$d copied", 1); showActivity(actDownload, "%1$.1f/%2$.1f MiB DL", MiB); showActivity(actCopyPath, "%1$.1f/%2$.1f MiB copied", MiB); @@ -213,6 +215,7 @@ public: ActInfo & actInfo = *i->second; actInfo.done = ev.getI(1); actInfo.expected = ev.getI(2); + actInfo.running = ev.getI(3); } if (ev.type == evSetExpected) { |