-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
Refactor get_time_stamp_ns #34536
Merged
fanyang-mono
merged 14 commits into
dotnet:master
from
fanyang-mono:refactor_time_stamp
Apr 24, 2020
Merged
Refactor get_time_stamp_ns #34536
Changes from 1 commit
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
5cf0c74
Refactor get_time_stamp_ns
fanyang-mono 1ce3889
Add place holder function for pc to make pc build pass
fanyang-mono 3004f2f
Add missing header file
fanyang-mono 90f6997
Move all time functions to mono-time.c
fanyang-mono 5637bb1
Make sampling_thread_running a global variable
fanyang-mono 5daacc1
Pass void* to init, clean_up and get_time function to accormodate dif…
fanyang-mono d4e5c60
Add static keyword for local helper function and fix a typo
fanyang-mono 8868991
Change to platform-specific typedef approach
fanyang-mono 5798ac6
Add missing header file for macOS
fanyang-mono 1871229
Add missing header file for linux
fanyang-mono fbe4611
Change header file name
fanyang-mono 27fb943
Change header file name one more time
fanyang-mono f8d34f6
Fix failures on macOS
fanyang-mono 0eadf6e
Update src/mono/mono/utils/mono-time.h
fanyang-mono File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -229,3 +229,39 @@ mono_100ns_datetime_from_timeval (struct timeval tv) | |
|
||
#endif | ||
|
||
#ifdef HOST_DARWIN | ||
|
||
static clock_serv_t sampling_clock_service; | ||
|
||
guint64 | ||
mono_clock_get_time_ns (void) | ||
{ | ||
kern_return_t ret; | ||
mach_timespec_t mach_ts; | ||
|
||
do { | ||
ret = clock_get_time (sampling_clock_service, &mach_ts); | ||
} while (ret == KERN_ABORTED); | ||
|
||
if (ret != KERN_SUCCESS) | ||
g_error ("%s: clock_get_time () returned %d", __func__, ret); | ||
|
||
return ((guint64) mach_ts.tv_sec * 1000000000) + (guint64) mach_ts.tv_nsec; | ||
} | ||
|
||
#else | ||
|
||
static clockid_t sampling_posix_clock; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same: the POSIX version of |
||
|
||
guint64 | ||
mono_clock_get_time_ns (void) | ||
{ | ||
struct timespec ts; | ||
|
||
if (clock_gettime (sampling_posix_clock, &ts) == -1) | ||
g_error ("%s: clock_gettime () returned -1, errno = %d", __func__, errno); | ||
|
||
return ((guint64) ts.tv_sec * 1000000000) + (guint64) ts.tv_nsec; | ||
} | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This used to be initialized in
clock_init()
undermono-posix.c
, but it's now always0
.