Combined binary.
[virt-mem.git] / lib / virt_mem_utils.ml
index db759dd..6ac7083 100644 (file)
@@ -95,3 +95,9 @@ let frequency xs =
   in
   let xs = loop xs in
   List.rev (List.sort compare xs)
+
+(* Pad a string to a fixed width (from virt-top, but don't truncate). *)
+let pad width str =
+  let n = String.length str in
+  if n >= width then str
+  else (* if n < width then *) str ^ String.make (width-n) ' '