All,
I have a few questions about timing...
1. Are the times printed by PolyML.timing `user' times or elapsed times? (I suspect the first but would like to check...)
2. Do any of these times include garbage collection?
3. Is there any way for an ML program to access these times, i.e. can they be bound (perhaps as a record) to an ML name? (Either at the top-level only or even within a program for time so far.)
4. If the utime component of Posix.ProcEnv.times () was used to measure sections of code within a program would this time include interludes for garbage collection? (Is the garbage collector a different process and therefore not counted in this `user' time?)
Thanks for any help, Phil.
Philip Clayton wrote:
- Are the times printed by PolyML.timing `user' times or elapsed
times? (I suspect the first but would like to check...)
Do any of these times include garbage collection?
Is there any way for an ML program to access these times, i.e. can
they be bound (perhaps as a record) to an ML name? (Either at the top-level only or even within a program for time so far.)
- If the utime component of Posix.ProcEnv.times () was used to measure
sections of code within a program would this time include interludes for garbage collection? (Is the garbage collector a different process and therefore not counted in this `user' time?)
Have a look at the Timer structure in the standard basis library.
PolyML.timing uses Timer.startCPUTimer to start a timer and Timer.checkCPUTimer to get the time, adding together the system and user time. These are CPU time except in Windows 95 and 98 which don't have CPU timing when it uses elapsed time. They include GC time.
Posix.ProcEnv.times uses the same underlying run-time system calls as the Timer functions, apart from the child process times. Unless you specifically need the child process times you're better off using the Timer structure. That includes a separate checkGCTime if you want the GC time.
Regards, David.
David Matthews wrote:
Philip Clayton wrote:
- Are the times printed by PolyML.timing `user' times or elapsed
times? (I suspect the first but would like to check...)
Do any of these times include garbage collection?
Is there any way for an ML program to access these times, i.e. can
they be bound (perhaps as a record) to an ML name? (Either at the top-level only or even within a program for time so far.)
- If the utime component of Posix.ProcEnv.times () was used to
measure sections of code within a program would this time include interludes for garbage collection? (Is the garbage collector a different process and therefore not counted in this `user' time?)
Have a look at the Timer structure in the standard basis library.
PolyML.timing uses Timer.startCPUTimer to start a timer and Timer.checkCPUTimer to get the time, adding together the system and user time. These are CPU time except in Windows 95 and 98 which don't have CPU timing when it uses elapsed time. They include GC time.
... the Timer structure. That includes a separate checkGCTime if you want the GC time.
You say that system and user times from Timer.checkCPUTimer include garbage collection. I would like to remove the garbage collection component from the user time. Hence I'd like to know whether the GC time from Timer.checkGCTime includes both system and user time or just user time? (I realize the system time, if included, will be small in comparison to the user time, but it would be useful to know.)
I am currently determining the running time of ML programs by performing test cases and fitting a function (in terms of a varied input) to the resulting times. As such, I'm looking to exclude garbage collection and system time to get a time that reflects the algorithms used in the program.
Thanks for your help, Phil.
On Thursday, Apr 8, 2004, at 18:26 Europe/London, Philip Clayton wrote:
David Matthews wrote:
Philip Clayton wrote:
- Are the times printed by PolyML.timing `user' times or elapsed
times? (I suspect the first but would like to check...)
Do any of these times include garbage collection?
Is there any way for an ML program to access these times, i.e.
can they be bound (perhaps as a record) to an ML name? (Either at the top-level only or even within a program for time so far.)
- If the utime component of Posix.ProcEnv.times () was used to
measure sections of code within a program would this time include interludes for garbage collection? (Is the garbage collector a different process and therefore not counted in this `user' time?)
Have a look at the Timer structure in the standard basis library.
You say that system and user times from Timer.checkCPUTimer include garbage collection. I would like to remove the garbage collection component from the user time. Hence I'd like to know whether the GC time from Timer.checkGCTime includes both system and user time or just user time? (I realize the system time, if included, will be small in comparison to the user time, but it would be useful to know.)
Funnily enough, this issue came up on the basis library mailing list recently and yesterday John Reppy posted a message saying
W.r.t., the GC time question, I'd like to propose adding a function
val checkCPUTimes : cpu_timer -> { gc : {sys : Time.time, usr : Time.time}, other : {sys : Time.time, usr : Time.time}
Of course, that's not in the current version so to answer your immediate question, I've checked the source code and Poly/ML currently counts only the user time for the garbage collection time. If you were really interested in filtering out the system time you could modify the driver source function record_gc_time in timing.c . Regards, David.