diff options
author | jb <jb@138bc75d-0d04-0410-961f-82ee72b054a4> | 2013-04-15 12:43:15 +0000 |
---|---|---|
committer | jb <jb@138bc75d-0d04-0410-961f-82ee72b054a4> | 2013-04-15 12:43:15 +0000 |
commit | 56910d862dff5f7f620b0e4be4feaf8bfa4d8463 (patch) | |
tree | de4249db60be7d49eb149f5d7ed57db6d0670016 /gcc/fortran/intrinsic.texi | |
parent | f6bbdcf62628538af217e1dfbc1d1c373af629fe (diff) | |
download | gcc-56910d862dff5f7f620b0e4be4feaf8bfa4d8463.tar.gz |
PR 56919 Improve SYSTEM_CLOCK intrinsic on Windows.
frontend ChangeLog:
2013-04-15 Janne Blomqvist <jb@gcc.gnu.org>
PR fortran/56919
* intrinsics.texi (SYSTEM_CLOCK): Update documentation.
libgfortran ChangeLog:
2013-04-15 Janne Blomqvist <jb@gcc.gnu.org>
PR fortran/56919
* intrinsics/time_1.h: Check __CYGWIN__ in addition to
__MINGW32__.
* intrinsics/system_clock.c (GF_CLOCK_MONOTONIC): Check
_POSIX_MONOTONIC_CLOCK as well.
(system_clock_4): Use GetTickCount on Windows.
(system_clock_8): Use QueryPerformanceCounter and
QueryPerformanceCounterFrequency on Windows.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@197968 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/fortran/intrinsic.texi')
-rw-r--r-- | gcc/fortran/intrinsic.texi | 49 |
1 files changed, 30 insertions, 19 deletions
diff --git a/gcc/fortran/intrinsic.texi b/gcc/fortran/intrinsic.texi index 8c0edc712a0..d5ff9a048dc 100644 --- a/gcc/fortran/intrinsic.texi +++ b/gcc/fortran/intrinsic.texi @@ -12038,27 +12038,38 @@ and should considered in new code for future portability. @item @emph{Description}: Determines the @var{COUNT} of a processor clock since an unspecified time in the past modulo @var{COUNT_MAX}, @var{COUNT_RATE} determines -the number of clock ticks per second. If the platform supports a high -resolution monotonic clock, that clock is used and can provide up to -nanosecond resolution. If a high resolution monotonic clock is not -available, the implementation falls back to a potentially lower -resolution realtime clock. - -@var{COUNT_RATE} is system dependent and can vary depending on the kind of the -arguments. For @var{kind=4} arguments, @var{COUNT} usually represents -milliseconds, while for @var{kind=8} arguments, @var{COUNT} typically -represents micro- or nanoseconds. @var{COUNT_MAX} usually equals -@code{HUGE(COUNT_MAX)}. - -If there is no clock, @var{COUNT} is set to @code{-HUGE(COUNT)}, and -@var{COUNT_RATE} and @var{COUNT_MAX} are set to zero. - -When running on a platform using the GNU C library (glibc), or a -derivative thereof, the high resolution monotonic clock is available -only when linking with the @var{rt} library. This can be done -explicitly by adding the @code{-lrt} flag when linking the +the number of clock ticks per second. If the platform supports a +monotonic clock, that clock is used and can, depending on the platform +clock implementation, provide up to nanosecond resolution. If a +monotonic clock is not available, the implementation falls back to a +realtime clock. + +@var{COUNT_RATE} is system dependent and can vary depending on the +kind of the arguments. For @var{kind=4} arguments, @var{COUNT} +represents milliseconds, while for @var{kind=8} arguments, @var{COUNT} +typically represents micro- or nanoseconds depending on resolution of +the underlying platform clock. @var{COUNT_MAX} usually equals +@code{HUGE(COUNT_MAX)}. Note that the millisecond resolution of the +@var{kind=4} version implies that the @var{COUNT} will wrap around in +roughly 25 days. In order to avoid issues with the wrap around and for +more precise timing, please use the @var{kind=4} version. + +If there is no clock, or querying the clock fails, @var{COUNT} is set +to @code{-HUGE(COUNT)}, and @var{COUNT_RATE} and @var{COUNT_MAX} are +set to zero. + +When running on a platform using the GNU C library (glibc) version +2.16 or older, or a derivative thereof, the high resolution monotonic +clock is available only when linking with the @var{rt} library. This +can be done explicitly by adding the @code{-lrt} flag when linking the application, but is also done implicitly when using OpenMP. +On the Windows platform, the version with @var{kind=4} arguments uses +the @code{GetTickCount} function, whereas the @var{kind=8} version +uses @code{QueryPerformanceCounter} and +@code{QueryPerformanceCounterFrequency}. For more information, and +potential caveats, please see the platform documentation. + @item @emph{Standard}: Fortran 95 and later |