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-24 16:12 [GC] Evaluate memory use Damien Doligez
@ 1999-11-24 18:39 ` Matías Giovannini
  0 siblings, 0 replies; 5+ messages in thread
From: Matías Giovannini @ 1999-11-24 18:39 UTC (permalink / raw)
  To: caml-list; +Cc: Damien Doligez, David.Mentre

Damien Doligez wrote:
> 
> >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

Hm, I can see a new debate coming about the vagaries of calendrical
calculations around the world...

ObOCaml, it would be *extremely* useful if it only were

1- A system-independent time service, together with:
2- A system-independent time-base value (say, microseconds), and
3- A system-independent date-zero value (say, the datetime of release of
CamlLight 0.7).

What I'm thinking about is a sub-second TOD clock that could serve both
as a timer and as a clock. If the OS doesn't provide it, it's relatively
easy to sinthesize such a clock with a wall clock and a sub-second
timer. The critical point in doing it inside the language and not in the
library would be thread synchronization, but maybe I'm mistaken.

Best regards,
Matías

PS.: I just realized that the hypotetical Clock.t type would have to be
64 bits wide at least, that makes it unwieldly to manipulate inside OCaml.

-- 
I was seized by the hallucination. I don't remember much, except for
being caught in an infinite recursion: I was myself feverishly
writing how I was seized by the hallucination.  I don't remember
much, except for being caught in an infinite recursion.




^ 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, 0 replies; 5+ messages in thread
From: David Mentré @ 1999-11-23 15:53 UTC (permalink / raw)
  To: Damien Doligez; +Cc: caml-list

Damien Doligez <Damien.Doligez@inria.fr> writes:

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

After thinking about it, both of them. :) But yes, as a safe
approximation, the first case would be enough. Something like the
maximum of RSS info from ps, but gathered inside my program.

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

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

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

Ok. Thanks.

[ another stupid attempt ]
> >    let max_words_total = stats.Gc.minor_words - stats.Gc.promoted_words
> >                          + stats.Gc.heap_words in
> 
> That just doesn't make sense.

:) I've never said I've understood the GC mechanism of OCaml. :) I'm
more used to the C language.


[ other question: wall clock time used by a program ]
> > I'm using 'Unix.gettimeofday ()'.
> 
> No, there's nothing simpler.  Is it not simple enough ?

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.


Thanks a lot for your answers,
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

* 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).