-
Notifications
You must be signed in to change notification settings - Fork 14.3k
[Flang][runtime] Distinguish CPU time and elapsed time for cpu_time and system_clock #96652
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
Merged
Merged
Changes from 6 commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
bc31456
Distinguish CPU time and elapsed time
mjklemm 9ec6a00
Rework fallback implementation to use C++11 high-res clock
mjklemm 850589d
Make clang-format happy
mjklemm 7d0dbb0
Add SystemClockCount to the no-cpp-dep.c test
mjklemm 82ca5e2
Fix Windows build
mjklemm f55b5fa
Test if system_clock() is returning a meaningful result
mjklemm c9d0959
Reduce precision requirement for the test
mjklemm a742c2f
Dump std::chrono and use timespec_get instead
mjklemm 940bddf
Remove constantly failing test
mjklemm a220155
Report proper max for count_max
mjklemm fc929d0
Refactor code a bit to reduce redundancy
mjklemm 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 hidden or 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 hidden or 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 hidden or 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 |
---|---|---|
@@ -0,0 +1,27 @@ | ||
! RUN: %flang -o %t %s | ||
! RUN: %t | ||
|
||
program system_clock_test | ||
use iso_fortran_env, only: int64, real64 | ||
implicit none | ||
|
||
integer, parameter :: delta = 1 | ||
real(kind=real64), parameter :: epsilon = 0.001 | ||
|
||
integer(kind=int64) :: t_start, t_end | ||
integer(kind=int64) :: rate | ||
real(kind=real64) :: diff | ||
|
||
call system_clock(count_rate=rate) | ||
|
||
call system_clock(t_start) | ||
call sleep(delta) | ||
call system_clock(t_end) | ||
|
||
diff = real(t_end - t_start, kind=real64) / real(rate, kind=real64) | ||
|
||
if (abs(diff - real(delta, kind=real64)) <= epsilon) then | ||
mjklemm marked this conversation as resolved.
Show resolved
Hide resolved
|
||
stop 0, quiet=.true. | ||
end if | ||
stop 1, quiet=.true. | ||
end program system_clock_test |
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.