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

Add built-in nanosecond-precision clocks #3068

Merged
merged 6 commits into from May 11, 2022
Merged

Conversation

runarorama
Copy link
Contributor

@runarorama runarorama commented May 10, 2022

This adds a few builtins for nanosecond-precision clocks.

  1. realtime returns the civic time as nanoseconds since epoch.
  2. monotonic returns a number of nanoseconds since an arbitrary point in the past, guaranteed to monotonically increase on subsequent calls. This is unaffected by time changes and other processes changing the system clock.
  3. processCPUTime returns the amount of time spent in the Unison process running the program.
  4. threadCPUTime returns the amount of time spent in the OS thread running the program.

Copy link
Contributor

@dolio dolio left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks fine to me, aside from the commented code that might have snuck in.

-- natToEFBox = inNat arg nat result $ outIoFail stack1 stack2 fail result
-- where
-- (arg, nat, stack1, stack2, fail, result) = fresh6

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe this commented code could go?

@pchiusano
Copy link
Member

@dolio are all these implementable in Chez land?

(This is something we should always ask ourselves for new builtins I think)

@dolio
Copy link
Contributor

dolio commented May 10, 2022

@runarorama runarorama requested a review from dolio May 10, 2022 19:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants