From 8675b2b075cbc83f5fa67be31edfd1cf43f82dad Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Thu, 5 May 2022 15:35:11 -0400 Subject: [PATCH] rename memoryUnits It's not just used for memory sizes. --- Annex/YoutubeDl.hs | 2 +- Command/Info.hs | 2 +- Utility/DataUnits.hs | 12 ++++++------ Utility/Metered.hs | 4 ++-- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/Annex/YoutubeDl.hs b/Annex/YoutubeDl.hs index 0916d2895f..659a9adc91 100644 --- a/Annex/YoutubeDl.hs +++ b/Annex/YoutubeDl.hs @@ -295,4 +295,4 @@ parseYoutubeDlProgress = go [] . reverse . progresschunks parsebytes = readSize units . takeWhile (not . isSpace) - units = memoryUnits ++ storageUnits + units = committeeUnits ++ storageUnits diff --git a/Command/Info.hs b/Command/Info.hs index f2c4761402..8a2583d17f 100644 --- a/Command/Info.hs +++ b/Command/Info.hs @@ -422,7 +422,7 @@ bloom_info = simpleStat "bloom filter size" $ do -- Two bloom filters are used at the same time when running -- git-annex unused, so double the size of one. sizer <- mkSizer - size <- sizer memoryUnits False . (* 2) . fromIntegral . fst <$> + size <- sizer committeeUnits False . (* 2) . fromIntegral . fst <$> lift bloomBitsHashes return $ size ++ note diff --git a/Utility/DataUnits.hs b/Utility/DataUnits.hs index 7fe4a0a4ae..6cae449c76 100644 --- a/Utility/DataUnits.hs +++ b/Utility/DataUnits.hs @@ -44,7 +44,7 @@ module Utility.DataUnits ( dataUnits, storageUnits, - memoryUnits, + committeeUnits, bandwidthUnits, oldSchoolUnits, Unit(..), @@ -68,7 +68,7 @@ data Unit = Unit ByteSize Abbrev Name deriving (Ord, Show, Eq) dataUnits :: [Unit] -dataUnits = storageUnits ++ memoryUnits ++ bandwidthUnits +dataUnits = storageUnits ++ committeeUnits ++ bandwidthUnits {- Storage units are (stupidly) powers of ten. -} storageUnits :: [Unit] @@ -87,9 +87,9 @@ storageUnits = p :: Integer -> Integer p n = 1000^n -{- Memory units are (stupidly named) powers of 2. -} -memoryUnits :: [Unit] -memoryUnits = +{- Committee units are (stupidly named) powers of 2. -} +committeeUnits :: [Unit] +committeeUnits = [ Unit (p 8) "YiB" "yobibyte" , Unit (p 7) "ZiB" "zebibyte" , Unit (p 6) "EiB" "exbibyte" @@ -128,7 +128,7 @@ bandwidthUnits = {- Do you yearn for the days when men were men and megabytes were megabytes? -} oldSchoolUnits :: [Unit] -oldSchoolUnits = zipWith (curry mingle) storageUnits memoryUnits +oldSchoolUnits = zipWith (curry mingle) storageUnits committeeUnits where mingle (Unit _ a n, Unit s' _ _) = Unit s' a n diff --git a/Utility/Metered.hs b/Utility/Metered.hs index 8fd9c9b667..0b9bb3486b 100644 --- a/Utility/Metered.hs +++ b/Utility/Metered.hs @@ -491,14 +491,14 @@ bandwidthMeter mtotalsize (MeterState (BytesProcessed old) before) (MeterState ( , estimatedcompletion ] where - amount = roughSize' memoryUnits True 2 new + amount = roughSize' committeeUnits True 2 new percentamount = case mtotalsize of Just (TotalSize 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" + rate = roughSize' committeeUnits True 0 bytespersecond ++ "/s" bytespersecond | duration == 0 = fromIntegral transferred | otherwise = floor $ fromIntegral transferred / duration -- 2.30.2