Add a header to node lists and print more data
authorIustin Pop <iustin@google.com>
Thu, 12 Mar 2009 20:16:41 +0000 (21:16 +0100)
committerIustin Pop <iustin@google.com>
Thu, 12 Mar 2009 20:16:41 +0000 (21:16 +0100)
This prints the total memory/disk and also adds a header.

src/Cluster.hs
src/Node.hs

index 5de0d88..d26d8eb 100644 (file)
@@ -569,7 +569,11 @@ printNodes ktn nl =
         snl' = map (\ n -> ((fromJust $ lookup (Node.idx n) ktn), n)) snl
         m_name = maximum . (map length) . fst . unzip $ snl'
         helper = Node.list m_name
-    in unlines $ map (uncurry helper) snl'
+        header = printf "%2s %-*s %5s %5s %5s %5s %5s %3s %3s %7s %7s"
+                 "N1" m_name "Name" "t_mem" "f_mem" "r_mem"
+                 "t_dsk" "f_dsk"
+                 "pri" "sec" "p_fmem" "p_fdsk"
+    in unlines $ (header:map (uncurry helper) snl')
 
 -- | Compute the mem and disk covariance.
 compDetailedCV :: NodeList -> (Double, Double, Double, Double)
index 8bb781d..1601366 100644 (file)
@@ -212,8 +212,9 @@ list mname n t =
         dp = p_dsk t
         fn = failN1 t
     in
-      printf " %c %-*s %5d %5d %5d %3d %3d %.5f %.5f"
+      printf " %c %-*s %5.0f %5d %5d %5.0f %5d %3d %3d %.5f %.5f"
                  (if fn then '*' else ' ')
-                 mname n (f_mem t) (r_mem t) ((f_dsk t) `div` 1024)
+                 mname n (t_mem t) (f_mem t) (r_mem t)
+                 ((t_dsk t) / 1024) ((f_dsk t) `div` 1024)
                  (length pl) (length sl)
                  mp dp