fromJust sols''
in iterateDepth xnl il newinst nreq (xi:ixes)
+printStats :: String -> Cluster.CStats -> IO ()
+printStats kind cs = do
+ printf "%s free RAM: %d\n" kind (Cluster.cs_fmem cs)
+ printf "%s allocatable RAM: %d\n" kind (Cluster.cs_amem cs)
+ printf "%s reserved RAM: %d\n" kind ((Cluster.cs_fmem cs) -
+ (Cluster.cs_amem cs))
+ printf "%s free disk: %d\n" kind (Cluster.cs_fdsk cs)
+ printf "%s allocatable disk: %d\n" kind (Cluster.cs_adsk cs)
+ printf "%s reserved disk: %d\n" kind ((Cluster.cs_fdsk cs) -
+ (Cluster.cs_adsk cs))
+ printf "%s max node allocatable RAM: %d\n" kind (Cluster.cs_mmem cs)
+ printf "%s max node allocatable disk: %d\n" kind (Cluster.cs_mdsk cs)
-- | Main function.
main :: IO ()
putStrLn $ Cluster.printNodes nl
let ini_cv = Cluster.compCV nl
- (orig_mem, orig_disk) = Cluster.totalResources nl
+ ini_stats = Cluster.totalResources nl
(if verbose > 2 then
printf "Initial coefficients: overall %.8f, %s\n"
else
printf "Initial score: %.8f\n" ini_cv)
printf "Initial instances: %d\n" num_instances
- printf "Initial free RAM: %d\n" orig_mem
- printf "Initial free disk: %d\n" orig_disk
+ printStats "Initial" ini_stats
let nmlen = Container.maxNameLen nl
newinst = Instance.create "new" (optIMem opts) (optIDsk opts)
fin_instances = num_instances + allocs
fin_ixes = reverse ixes
ix_namelen = maximum . map (length . Instance.name) $ fin_ixes
- (final_mem, final_disk) = Cluster.totalResources fin_nl
+ fin_stats = Cluster.totalResources fin_nl
printf "Final score: %.8f\n" (Cluster.compCV fin_nl)
printf "Final instances: %d\n" (num_instances + allocs)
- printf "Final free RAM: %d\n" final_mem
- printf "Final free disk: %d\n" final_disk
+ printStats "Final" fin_stats
printf "Usage: %.5f\n" (((fromIntegral num_instances)::Double) /
(fromIntegral fin_instances))
printf "Allocations: %d\n" allocs
when (optShowNodes opts) $
do
- let (orig_mem, orig_disk) = Cluster.totalResources nl
- (final_mem, final_disk) = Cluster.totalResources fin_nl
putStrLn ""
putStrLn "Final cluster status:"
putStrLn $ Cluster.printNodes fin_nl
- when (verbose > 3) $
- do
- printf "Original: mem=%d disk=%d\n" orig_mem orig_disk
- printf "Final: mem=%d disk=%d\n" final_mem final_disk