From ba44ca80e66a3ea77ede0377763d8294694dd244 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Wed, 14 Mar 2018 13:39:14 -0400 Subject: [PATCH] Include amount of data transferred in progress display. --- CHANGELOG | 1 + Utility/Metered.hs | 21 ++++++++++++--------- 2 files changed, 13 insertions(+), 9 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index 6d007141e1..4feb88227c 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -36,6 +36,7 @@ git-annex (6.20180228) UNRELEASED; urgency=medium * Note that Remote/Git.hs now contains AGPL licensed code, thus the license of git-annex as a whole is AGPL. This was already the case when git-annex was built with the webapp enabled. + * Include amount of data transferred in progress display. -- Joey Hess Wed, 28 Feb 2018 11:53:03 -0400 diff --git a/Utility/Metered.hs b/Utility/Metered.hs index 2fdb700948..8514494c4c 100644 --- a/Utility/Metered.hs +++ b/Utility/Metered.hs @@ -355,23 +355,26 @@ clearMeterHandle (Meter _ _ v _) h = do hFlush h -- | Display meter in the form: --- 10% 300 KiB/s 16m40s +-- 10% 1.3MiB 300 KiB/s 16m40s -- or when total size is not known: --- 1.3 MiB 300 KiB/s +-- 1.3 MiB 300 KiB/s bandwidthMeter :: RenderMeter bandwidthMeter mtotalsize (BytesProcessed old, before) (BytesProcessed new, now) = unwords $ catMaybes - [ Just percentoramount - -- Pad enough for max width: "xxxx.xx KiB xxxx KiB/s" - , Just $ replicate (23 - length percentoramount - length rate) ' ' + [ Just percentamount + -- Pad enough for max width: "100% xxxx.xx KiB xxxx KiB/s" + , Just $ replicate (29 - length percentamount - length rate) ' ' , Just rate , estimatedcompletion ] where - percentoramount = case mtotalsize of - Just totalsize -> showPercentage 0 $ - percentage totalsize (min new totalsize) - Nothing -> roughSize' memoryUnits True 2 new + amount = roughSize' memoryUnits True 2 new + percentamount = case mtotalsize of + Just totalsize -> + let p = showPercentage 0 $ + percentage totalsize (min new totalsize) + in p ++ replicate (6 - length p) ' ' ++ amount + Nothing -> amount rate = roughSize' memoryUnits True 0 bytespersecond ++ "/s" bytespersecond | duration == 0 = fromIntegral transferred