Commit ca848e2a authored by Iustin Pop's avatar Iustin Pop
Browse files

htools: small simplification to parseUtilisation



We eliminate the local variable as it's used only once.
Signed-off-by: default avatarIustin Pop <iustin@google.com>
Reviewed-by: default avatarGuido Trotter <ultrotter@google.com>
parent 0e09422b
...@@ -57,17 +57,17 @@ wrapIO = flip catch (return . Bad . show) ...@@ -57,17 +57,17 @@ wrapIO = flip catch (return . Bad . show)
parseUtilisation :: String -> Result (String, DynUtil) parseUtilisation :: String -> Result (String, DynUtil)
parseUtilisation line = parseUtilisation line =
let columns = sepSplit ' ' line case sepSplit ' ' line of
in case columns of [name, cpu, mem, dsk, net] ->
[name, cpu, mem, dsk, net] -> do do
rcpu <- tryRead name cpu rcpu <- tryRead name cpu
rmem <- tryRead name mem rmem <- tryRead name mem
rdsk <- tryRead name dsk rdsk <- tryRead name dsk
rnet <- tryRead name net rnet <- tryRead name net
let du = DynUtil { cpuWeight = rcpu, memWeight = rmem let du = DynUtil { cpuWeight = rcpu, memWeight = rmem
, dskWeight = rdsk, netWeight = rnet } , dskWeight = rdsk, netWeight = rnet }
return (name, du) return (name, du)
_ -> Bad $ "Cannot parse line " ++ line _ -> Bad $ "Cannot parse line " ++ line
-- | External tool data loader from a variety of sources. -- | External tool data loader from a variety of sources.
loadExternalData :: Options loadExternalData :: Options
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment