Patchwork [libfortran] Use high resolution clock if available, timing cleanup

login
register
mail settings
Submitter Janne Blomqvist
Date Jan. 31, 2011, 9 p.m.
Message ID <AANLkTi=wuGa0c4D8Q2EPwQgNka6-CyCd-j6U6iw4Wjcz@mail.gmail.com>
Download mbox | patch
Permalink /patch/81232/
State New
Headers show

Comments

Janne Blomqvist - Jan. 31, 2011, 9 p.m.
On Mon, Jan 31, 2011 at 22:53, Janne Blomqvist
<blomqvist.janne@gmail.com> wrote:
> On Mon, Jan 31, 2011 at 22:46, Steve Kargl
> <sgk@troutmask.apl.washington.edu> wrote:
>> On Mon, Jan 31, 2011 at 10:18:45PM +0200, Janne Blomqvist wrote:
>>> 2011-01-31  Janne Blomqvist  <jb@gcc.gnu.org>
>>>
>>>       * configure.ac: Check for clock_gettime().
>>>       * configure: Regenerated.
>>>       * config.h.in: Regenerated.
>>>       * intrinsics/time_1.h (__time_1): Rename to gf_cputime, add
>>>       times() fallback.
>>>       (gf_gettime): New function.
>>>       * intrinsics/cpu_time.c (__cpu_time_1): Update to call gf_cputime.
>>>       * intrinsics/date_and_time.c (date_and_time): Use gf_gettime.
>>>       * intrinsics/dtime.c (dtime_sub): Use gf_cputime.
>>>       * intrinsics/etime.c (etime_sub): Use gf_cputime.
>>>       * intrinsics/system_clock.c (system_clock_4): Use gf_gettime.
>>>       (system_clock_8): Use gf_gettime, increase count rate to allow
>>>       nanosecond precision, remove overflow prone branch.
>>>
>>
>> OK.
>
> Thanks for the quick review!
>
> Sending        libgfortran/ChangeLog
> Sending        libgfortran/config.h.in
> Sending        libgfortran/configure
> Sending        libgfortran/configure.ac
> Sending        libgfortran/intrinsics/cpu_time.c
> Sending        libgfortran/intrinsics/date_and_time.c
> Sending        libgfortran/intrinsics/dtime.c
> Sending        libgfortran/intrinsics/etime.c
> Sending        libgfortran/intrinsics/system_clock.c
> Sending        libgfortran/intrinsics/time_1.h
> Transmitting file data ..........
> Committed revision 169449.

Oops, I just noticed a small bug,


Committed r169450 as obvious.

Patch

Index: intrinsics/time_1.h
===================================================================
--- intrinsics/time_1.h (revision 169449)
+++ intrinsics/time_1.h (working copy)
@@ -184,7 +184,7 @@  gf_cputime (long *user_sec, long *user_u
 #ifdef CLOCK_MONOTONIC
 #define GF_CLOCK_MONOTONIC CLOCK_MONOTONIC
 #else
-#define GF_CLOCK_REALTIME GF_CLOCK_REALTIME
+#define GF_CLOCK_MONOTONIC GF_CLOCK_REALTIME
 #endif

 /* Arguments:
Index: ChangeLog
===================================================================
--- ChangeLog   (revision 169449)
+++ ChangeLog   (working copy)
@@ -1,5 +1,9 @@ 
 2011-01-31  Janne Blomqvist  <jb@gcc.gnu.org>

+       * intrinsics/time_1.h: Fix definition of GF_CLOCK_MONOTONIC macro.
+
+2011-01-31  Janne Blomqvist  <jb@gcc.gnu.org>
+
        * configure.ac: Check for clock_gettime().
        * configure: Regenerated.
        * config.h.in: Regenerated.