From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: weis Received: (from weis@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id UAA32295 for caml-redistribution; Thu, 18 Nov 1999 20:30:12 +0100 (MET) Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id PAA27562 for ; Thu, 18 Nov 1999 15:37:28 +0100 (MET) Received: from parasite.irisa.fr (parasite.irisa.fr [131.254.12.47]) by nez-perce.inria.fr (8.8.7/8.8.7) with ESMTP id PAA27868 for ; Thu, 18 Nov 1999 15:37:27 +0100 (MET) Received: from parate.irisa.fr (parate.irisa.fr [131.254.12.25]) by parasite.irisa.fr (8.9.3/8.9.3) with ESMTP id PAA12472 for ; Thu, 18 Nov 1999 15:37:26 +0100 (MET) Sender: weis To: caml-list@inria.fr Subject: [GC] Evaluate memory use From: David.Mentre@irisa.fr (David =?iso-8859-1?q?Mentré?=) Date: 18 Nov 1999 15:37:26 +0100 Message-ID: User-Agent: Gnus/5.070098 (Pterodactyl Gnus v0.98) Emacs/20.4 MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit [ short french: Comment connaître la consommation mémoire maximum d'un programme OCaml ? ] Hello all Caml users/hackers, Is there any way to know the maximum memory used by an OCaml program? Right now, I'm using Gc.heap_words, but it doesn't seem to be very accurate. I think because the minor heap words are not counted. Anyway to fix this? Should I use something like: let max_words_total = stats.Gc.minor_words - stats.Gc.promoted_words + stats.Gc.heap_words in Used code below: let print_computation_stats elapsed_time = let stats = Gc.stat () in let max_words_total = stats.Gc.heap_words in printf "@\n@[##### Statistics #####@\n" ; printf "Maximum memory used: %d kBytes@\n" (max_words_total * Sys.word_size / 8 / 1024) ; printf "Processor time used: %f seconds@\n" (Sys.time ()) ; printf "Wall clock time used: %f seconds@\n" elapsed_time ; printf "@\n" ; printf "@]@\n@?" BTW, is there any simple way to evaluate Wall Clock Time used by an OCaml program? Right now, I'm using 'Unix.gettimeofday ()'. Is there a simpler way to do it? let start_time = Unix.gettimeofday () in let produced_properties = verify properties prog possible_projections in let stop_time = Unix.gettimeofday () in print_computation_stats (stop_time -. start_time) ; Best regards, david -- David.Mentre@irisa.fr -- http://www.irisa.fr/prive/dmentre/ Opinions expressed here are only mine.