[all-commits] [llvm/llvm-project] 0104cc: [flang] Add default implementation for SYSTEM_CLOCK
Diana via All-commits
all-commits at lists.llvm.org
Wed Aug 18 00:48:16 PDT 2021
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: 0104cc85b14aad7980360f58a1159463f8da5adb
https://github.com/llvm/llvm-project/commit/0104cc85b14aad7980360f58a1159463f8da5adb
Author: Diana Picus <diana.picus at linaro.org>
Date: 2021-08-18 (Wed, 18 Aug 2021)
Changed paths:
M flang/runtime/time-intrinsic.cpp
M flang/unittests/Runtime/Time.cpp
Log Message:
-----------
[flang] Add default implementation for SYSTEM_CLOCK
Add an implementation for the runtime functions related to SYSTEM_CLOCK.
As with CPU_TIME, this is based on std::clock(), which should be
available everywhere, but it is highly recommended to add
platform-specific implementations for systems where std::clock() behaves
poorly (e.g. POSIX).
The documentation for std::clock() doesn't specify a maximum value and
in fact wrap around behaviour is non-conforming. Therefore, this
implementation of SYSTEM_CLOCK is not guaranteed to wrap around either,
and after std::clock reaches its maximum value we will likely just
return failure rather than wrap around. If this happens often on your
system, please add a new platform-specific implementation.
We define COUNT_MAX as either the maximum value that can be stored in
a std::clock_t or in a 64-bit integer (whichever is smaller), and
COUNT_RATE as CLOCKS_PER_SEC. For POSIX systems, the value of
CLOCKS_PER_SEC is hardcoded to 10^6 and irrelevant for the values
returned by std::clock.
Differential Revision: https://reviews.llvm.org/D105969
More information about the All-commits
mailing list