Hi,

On Tue, May 26, 2009 at 07:02:16PM +0200, Gabriel Kerneis wrote:
> [By the way, ocamlutil/stats.ml is broken on 64bit architectures, the
> figures returned by printM in Stats.print should by doubled. I'll send a
> patch for this one too.]

Please find the patch attached. David, I'd be glad if you could apply
it.

Here is the relevant bit of the Ocaml manual:
  The total amount of memory allocated by the program since it was started
  is (in words) minor_words + major_words - promoted_words. Multiply by
  the word size (4 on a 32-bit machine, 8 on a 64-bit machine) to get the
  number of bytes.
  http://caml.inria.fr/pub/docs/manual-ocaml/libref/Gc.html

Regards,
-- 
Gabriel Kerneis
diff -ur cil-darcs/ocamlutil/stats.ml cil-patched/ocamlutil/stats.ml
--- cil-darcs/ocamlutil/stats.ml	2009-05-28 10:57:08.000000000 +0200
+++ cil-patched/ocamlutil/stats.ml	2009-05-28 12:27:30.000000000 +0200
@@ -100,7 +100,8 @@
      else "Unix.time");
   let gc = Gc.quick_stat () in 
   let printM (w: float) : string = 
-    Printf.sprintf "%.2fMb" (w *. 4.0 /. 1000000.0)
+    let coeff = float_of_int (Sys.word_size / 8) in
+    Printf.sprintf "%.2fMb" (w *. coeff /. 1000000.0)
   in
   Printf.fprintf chn 
     "Memory statistics: total=%s, max=%s, minor=%s, major=%s, promoted=%s\n    minor collections=%d  major collections=%d compactions=%d\n"
------------------------------------------------------------------------------
Register Now for Creativity and Technology (CaT), June 3rd, NYC. CaT 
is a gathering of tech-side developers & brand creativity professionals. Meet
the minds behind Google Creative Lab, Visual Complexity, Processing, & 
iPhoneDevCamp as they present alongside digital heavyweights like Barbarian 
Group, R/GA, & Big Spaceship. http://p.sf.net/sfu/creativitycat-com 
_______________________________________________
CIL-users mailing list
CIL-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/cil-users

Reply via email to