caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* Re: [GC] Evaluate memory use
@ 1999-11-24 16:12 Damien Doligez
  1999-11-24 18:39 ` Matías Giovannini
  0 siblings, 1 reply; 5+ messages in thread
From: Damien Doligez @ 1999-11-24 16:12 UTC (permalink / raw)
  To: Damien.Doligez, David.Mentre; +Cc: caml-list

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 426 bytes --]

>From: David.Mentre@irisa.fr (David =?iso-8859-1?q?Mentré?=)

>If I've understood the 2.02 doc, the compaction mechanism is disabled by
>default. Right? So the below method is safe. Right?

Yes.


>Oh no. I've managed to use it. :) That's only because I must use the
>Unix module solely on this purpose. It was just to avoid such use.

Maybe some day, we'll have date and time functions in the standard
library.

-- Damien




^ permalink raw reply	[flat|nested] 5+ messages in thread
* Re:  [GC] Evaluate memory use
@ 1999-11-22 19:24 Damien Doligez
  1999-11-23 15:53 ` David Mentré
  0 siblings, 1 reply; 5+ messages in thread
From: Damien Doligez @ 1999-11-22 19:24 UTC (permalink / raw)
  To: caml-list

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain, Size: 1358 bytes --]

>From: David.Mentre@irisa.fr (David =?iso-8859-1?q?Mentré?=)

[ short french:

 > Comment connaître la consommation mémoire maximum d'un programme OCaml

 Vous pouvez répéter la question ?
]


>Is there any way to know the maximum memory used by an OCaml program?

What do you mean exactly by "maximum memory used" ?  Is it the maximum
amount of memory allocated from the OS or the maximum amount used to
store useful data ?  In the first case, it's the current amount,
unless you activate the compacter; in the second case, there's no way
to get the right answer.


>Right now, I'm using Gc.heap_words, but it doesn't seem to be very

That's the current size of the major heap, including overhead and free
memory.  You could add "control.Gc.minor_heap_size" (from the result
of "Gc.get ()") to get the total size of the heaps.


>    let max_words_total = stats.Gc.minor_words - stats.Gc.promoted_words
>                          + stats.Gc.heap_words in

That just doesn't make sense.  It's the number of garbage words
collected by the minor GC (since the program started), added to the
current size of the major heap.


>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?

No, there's nothing simpler.  Is it not simple enough ?

-- Damien




^ permalink raw reply	[flat|nested] 5+ messages in thread
* [GC] Evaluate memory use
@ 1999-11-18 14:37 David Mentré
  0 siblings, 0 replies; 5+ messages in thread
From: David Mentré @ 1999-11-18 14:37 UTC (permalink / raw)
  To: caml-list

[ 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@[<v 2>##### 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.




^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~1999-11-24 22:19 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1999-11-24 16:12 [GC] Evaluate memory use Damien Doligez
1999-11-24 18:39 ` Matías Giovannini
  -- strict thread matches above, loose matches on Subject: below --
1999-11-22 19:24 Damien Doligez
1999-11-23 15:53 ` David Mentré
1999-11-18 14:37 David Mentré

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).