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

macOS: Use clock_gettime_nsec_np() for omrtime_hires_clock() #6568

Merged
merged 1 commit into from
Jun 15, 2022

Conversation

knn-k
Copy link
Contributor

@knn-k knn-k commented Jun 15, 2022

This commit changes the implementation of omrtime_hires_clock() for
macOS.

Signed-off-by: KONNO Kazuhiro konno@jp.ibm.com

This commit changes the implementation of omrtime_hires_clock() for
macOS.

Signed-off-by: KONNO Kazuhiro <konno@jp.ibm.com>
@knn-k
Copy link
Contributor Author

knn-k commented Jun 15, 2022

See eclipse-openj9/openj9#14636 (comment) for the background.

This commit implements monotonic omrtime_hires_clock() for macOS. Apple's document (https://developer.apple.com/documentation/kernel/1646199-mach_continuous_time) mentions clock_gettime_nsec_np(CLOCK_MONOTONIC_RAW). It returns __uint64_t.

There is a design choice here: Should omrtime_hires_clock() return nanoseconds or microseconds (as it does for other UNIXes)?

@knn-k knn-k marked this pull request as ready for review June 15, 2022 07:53
@knn-k knn-k merged commit eed9007 into eclipse:master Jun 15, 2022
@knn-k
Copy link
Contributor Author

knn-k commented Jun 15, 2022

I merged my own PR by mistake.
Reverting by #6569.

@dmitripivkine
Copy link
Contributor

dmitripivkine commented Jun 15, 2022

There is a design choice here: Should omrtime_hires_clock() return nanoseconds or microseconds (as it does for other UNIXes)?

The resolution of returned clock is hardcoded in OMRTIME_HIRES_CLOCK_FREQUENCY. It makes omrtime_hires_delta() work properly. In the case resolution of omrtime_hires_clock() return is going to be changed to nanoseconds this constant should be redefined accordingly

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

Successfully merging this pull request may close these issues.

None yet

2 participants