rename memoryUnits
It's not just used for memory sizes.
This commit is contained in:
parent
d1cce869ed
commit
8675b2b075
4 changed files with 10 additions and 10 deletions
|
@ -295,4 +295,4 @@ parseYoutubeDlProgress = go [] . reverse . progresschunks
|
||||||
|
|
||||||
parsebytes = readSize units . takeWhile (not . isSpace)
|
parsebytes = readSize units . takeWhile (not . isSpace)
|
||||||
|
|
||||||
units = memoryUnits ++ storageUnits
|
units = committeeUnits ++ storageUnits
|
||||||
|
|
|
@ -422,7 +422,7 @@ bloom_info = simpleStat "bloom filter size" $ do
|
||||||
-- Two bloom filters are used at the same time when running
|
-- Two bloom filters are used at the same time when running
|
||||||
-- git-annex unused, so double the size of one.
|
-- git-annex unused, so double the size of one.
|
||||||
sizer <- mkSizer
|
sizer <- mkSizer
|
||||||
size <- sizer memoryUnits False . (* 2) . fromIntegral . fst <$>
|
size <- sizer committeeUnits False . (* 2) . fromIntegral . fst <$>
|
||||||
lift bloomBitsHashes
|
lift bloomBitsHashes
|
||||||
|
|
||||||
return $ size ++ note
|
return $ size ++ note
|
||||||
|
|
|
@ -44,7 +44,7 @@
|
||||||
module Utility.DataUnits (
|
module Utility.DataUnits (
|
||||||
dataUnits,
|
dataUnits,
|
||||||
storageUnits,
|
storageUnits,
|
||||||
memoryUnits,
|
committeeUnits,
|
||||||
bandwidthUnits,
|
bandwidthUnits,
|
||||||
oldSchoolUnits,
|
oldSchoolUnits,
|
||||||
Unit(..),
|
Unit(..),
|
||||||
|
@ -68,7 +68,7 @@ data Unit = Unit ByteSize Abbrev Name
|
||||||
deriving (Ord, Show, Eq)
|
deriving (Ord, Show, Eq)
|
||||||
|
|
||||||
dataUnits :: [Unit]
|
dataUnits :: [Unit]
|
||||||
dataUnits = storageUnits ++ memoryUnits ++ bandwidthUnits
|
dataUnits = storageUnits ++ committeeUnits ++ bandwidthUnits
|
||||||
|
|
||||||
{- Storage units are (stupidly) powers of ten. -}
|
{- Storage units are (stupidly) powers of ten. -}
|
||||||
storageUnits :: [Unit]
|
storageUnits :: [Unit]
|
||||||
|
@ -87,9 +87,9 @@ storageUnits =
|
||||||
p :: Integer -> Integer
|
p :: Integer -> Integer
|
||||||
p n = 1000^n
|
p n = 1000^n
|
||||||
|
|
||||||
{- Memory units are (stupidly named) powers of 2. -}
|
{- Committee units are (stupidly named) powers of 2. -}
|
||||||
memoryUnits :: [Unit]
|
committeeUnits :: [Unit]
|
||||||
memoryUnits =
|
committeeUnits =
|
||||||
[ Unit (p 8) "YiB" "yobibyte"
|
[ Unit (p 8) "YiB" "yobibyte"
|
||||||
, Unit (p 7) "ZiB" "zebibyte"
|
, Unit (p 7) "ZiB" "zebibyte"
|
||||||
, Unit (p 6) "EiB" "exbibyte"
|
, Unit (p 6) "EiB" "exbibyte"
|
||||||
|
@ -128,7 +128,7 @@ bandwidthUnits =
|
||||||
|
|
||||||
{- Do you yearn for the days when men were men and megabytes were megabytes? -}
|
{- Do you yearn for the days when men were men and megabytes were megabytes? -}
|
||||||
oldSchoolUnits :: [Unit]
|
oldSchoolUnits :: [Unit]
|
||||||
oldSchoolUnits = zipWith (curry mingle) storageUnits memoryUnits
|
oldSchoolUnits = zipWith (curry mingle) storageUnits committeeUnits
|
||||||
where
|
where
|
||||||
mingle (Unit _ a n, Unit s' _ _) = Unit s' a n
|
mingle (Unit _ a n, Unit s' _ _) = Unit s' a n
|
||||||
|
|
||||||
|
|
|
@ -491,14 +491,14 @@ bandwidthMeter mtotalsize (MeterState (BytesProcessed old) before) (MeterState (
|
||||||
, estimatedcompletion
|
, estimatedcompletion
|
||||||
]
|
]
|
||||||
where
|
where
|
||||||
amount = roughSize' memoryUnits True 2 new
|
amount = roughSize' committeeUnits True 2 new
|
||||||
percentamount = case mtotalsize of
|
percentamount = case mtotalsize of
|
||||||
Just (TotalSize totalsize) ->
|
Just (TotalSize totalsize) ->
|
||||||
let p = showPercentage 0 $
|
let p = showPercentage 0 $
|
||||||
percentage totalsize (min new totalsize)
|
percentage totalsize (min new totalsize)
|
||||||
in p ++ replicate (6 - length p) ' ' ++ amount
|
in p ++ replicate (6 - length p) ' ' ++ amount
|
||||||
Nothing -> amount
|
Nothing -> amount
|
||||||
rate = roughSize' memoryUnits True 0 bytespersecond ++ "/s"
|
rate = roughSize' committeeUnits True 0 bytespersecond ++ "/s"
|
||||||
bytespersecond
|
bytespersecond
|
||||||
| duration == 0 = fromIntegral transferred
|
| duration == 0 = fromIntegral transferred
|
||||||
| otherwise = floor $ fromIntegral transferred / duration
|
| otherwise = floor $ fromIntegral transferred / duration
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue