This is the mail archive of the fortran@gcc.gnu.org mailing list for the GNU Fortran project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [patch, fortran] PR34533 - dtime vs. etime


Daniel Franke wrote:
Hi all.

This patch fixes an oversight with ETIME/DTIME. While ETIME reports the ressource usage since invokation of the application, DTIME is supposed to give the ressource usage since the last invokation of DTIME. Up until now, DTIME was an alias of ETIME.

The library implementation of DTIME uses a mutex to ensure data integregrity if used with multiple threads, e.g. OpenMP. If no time-source is available, DTIME returns -1 for each of its output values for each invokation.

Further, I took the opportunity to merge similar codes used dor CPU_TIME and ETIME into a single function which now can be used by all three intrinsics, CPU_TIME, DTIME and ETIME. This also implies that we now can provide a working implementation of DTIME/ETIME for mingw.

FX, would you be so kind to test these functions there? :)


:ADDPATCH fortran:


gcc/fortran:
2007-12-21  Daniel Franke  <franke.daniel@gmail.com>

* intrinsic.h (gfc_check_etime): Renamed to ...
(gfc_check_dtime_etime): ... this.
(gfc_check_etime_sub): Renamed to ...
(gfc_check_dtime_etime_sub): ... this.
(gfc_resolve_dtime_sub): New prototype.
* check.c (gfc_check_etime): Renamed to ...
(gfc_check_dtime_etime): ... this.
(gfc_check_etime_sub): Renamed to ...
(gfc_check_dtime_etime_sub): ... this.
* iresolve.c (gfc_resolve_dtime_sub): New implementation.
* intrinsic.c (add_functions): Removed alias from ETIME to DTIME,
added stand-alone intrinsic DTIME.
(add_subroutines): Adjusted check and resolve function names for
DTIME and ETIME.
* trans-intrinsic.c (gfc_conv_intrinsic_function): Added DTIME
to known functions in switch.
* intrinsic.texi (DTIME): Added paragraph about thread-safety, fixed return value section.
(CPU_TIME): Clarified intent and added implementation notes.


libgfortran:
2007-12-21  Daniel Franke  <franke.daniel@gmail.com>

* intrinsics/cpu_time.c: Moved code commonly usable for CPU_TIME,
DTIME and ETIME to ...
* intrinsics/time_1.h: ... here.
* intrinsics/dtime.c: New file.
* intrinsics/etime.c: Newly implemented using the common time-aquisition function from time_1.h.
* gfortran.map (_gfortran_dtime, _gfortran_dtime_sub): New.
* Makefile.am: Added new file.
* Makefile.in: Regenerated.
* configure: Regenerated.



I'm not sure that I got all the various macros right, this might be a source of easily-fixable regressions on some platforms ...


The patch does not contain the regenerated files as I currently do not have the appropriate version of autoconf available.

Bootstrapped and regression tested on i686-pc-linux-gnu. Ok for trunk?

Regards
	Daniel


In this comment:


"Note that @var{TIME} may contain a, system depenent, arbitrary offset"

s/depenent/dependent/

and here:

"Elapsed time in seconds since the last invokation or since the"

s/invokation/invocation/

and here:

Copyright (C) 2004, 2005, 2006, 2007 Free Software Foundation, Inc.

If this is a new file I think it should just have the year 2007. (?)


I do think we need some sort of thread test. OK


I suggest you commit for now and then we can add a test later after consulting with the gomp wizards.

Jerry



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]