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, libfortran] PR 47571 Some janitorial cleanup


On 02/03/2011 04:45 AM, Janne Blomqvist wrote:
On Wed, Feb 2, 2011 at 21:23, Janne Blomqvist<blomqvist.janne@gmail.com> wrote:
Hi,

I reviewed the Gfortran time intrinsics, both standard and extensions,
and AFAIK the only place where a monotonic clock fits the API, and
where we can expose high resolution, is the SYSTEM_CLOCK intrinsic.

Now, due to the PR 47571 fix where we now call clock_gettime() via a
weakref, some of the original reason behind the gf_gettime() wrapper
has been lost, as now we still need to include fallback code in case
the weakref is not available. This needlessly bloats the code for
date_and_time() which is unable to use either the extra precision and
needs a realtime clock, not a monotonic clock. Additionally, in some
not quite bleeding edge Linux kernels, gettimeofday() is a vsyscall
and clock_gettime() isn't, leading to higher overhead for no benefit
(the difference is something like 1e6 vs 1e7 calls/s on current hw, so
it's exceedingly unlikely to actually matter in reality).  The only
fly in the ointment here is that POSIX 2008 has marked gettimeofday()
as obsolescent, however I don't see this mattering in reality for the
foreseeable future.

The attached patch moves all the weakref trickery and clock_gettime()
usage from time_1.h to system_clock.c, where the only benefactor also
lives.

Hi,


updated patch attached. Compared to the previous one this might fix
the build regression reported on HP-UX which does support weak symbols
but apparently does barf on weak undefined references. This is done in
a slightly kludgy way, in that in acinclude.m4 we previously have set
GTHREAD_USE_WEAK to 0 for such targets, hence in the updated patch
GTHREAD_USE_WEAK is defined and set to 1 if it's not previously
present, and then we check for both SUPPORTS_WEAK and
GTHREAD_USE_WEAK.

2011-02-03 Janne Blomqvist<jb@gcc.gnu.org>

	PR libfortran/47571
	* intrinsics/time_1.h (GF_CLOCK_MONOTONIC): Move to system_clock.c.
	(weak_gettime): Likewise.
	(gf_gettime): Change API, move weak_gettime() usage to
	system_clock.c
	* intrinsics/system_clock.c (GTHREAD_USE_WEAK): Define.
	(gf_gettime_mono): New function.
	(system_clock_4): Use gf_gettime_mono().
	(system_clock_8): Likewise.
	* intrinsics/date_and_time.c (date_and_time): Update gf_gettime()
	usage.

Regtested on x86_64-unknown-linux-gnu, Ok for trunk?


OK and thanks for patch.


Jerry


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