Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unix module, binding to getrusage() #8378

Closed
vicuna opened this issue Nov 21, 2003 · 1 comment
Closed

Unix module, binding to getrusage() #8378

vicuna opened this issue Nov 21, 2003 · 1 comment

Comments

@vicuna
Copy link

vicuna commented Nov 21, 2003

Original bug ID: 1937
Reporter: administrator
Status: closed (set by @damiendoligez on 2012-01-27T18:50:29Z)
Resolution: fixed
Priority: normal
Severity: feature
Fixed in version: 3.09.2
Category: ~DO NOT USE (was: OCaml general)

Bug description

Full_Name: Daniel Bünzli
Version: 3.07+2
OS: MacOS X 10.3.1
Submission from: 45.45.203.62.dial.bluewin.ch (62.203.45.45)

The resolution of Unix.times() is too low. Subtracting figures returned by two
subsequent calls to the function one often gets 0.0 (even if some code was
executed meanwhile).

(Unix.times()).Unix.tms_utime -. (Unix.times()).Unix.tms_utime;;

  • : float = 0.

Unix.gettimeofday(), has a good resolution however it doesn't enable one to make
the difference between user and system time.

(Unix.gettimeofday()) -. (Unix.gettimeofday());;

  • : float = 2.02655792236328125e-06

A binding in the Unix module to the getrusage [1] function would give user and
system times with the accuracy of gettimeofday, that is possibly down to
microseconds (actual resolution is system dependent).

Thanks for considering,

Daniel

[1] http://www.opengroup.org/onlinepubs/007904975/functions/getrusage.html
http://www.opengroup.org/onlinepubs/007904975/basedefs/sys/resource.h.html

@vicuna
Copy link
Author

vicuna commented Jan 27, 2012

Comment author: @damiendoligez

Fixed in 3.09.2 and in trunk (commit 7382): Unix.times now calls getrusage if available.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant