On 30/10/2024 16:06, Andi Kleen wrote:
On Wed, Oct 23, 2024 at 02:56:51PM +0200, Richard Biener wrote:
On Wed, Oct 9, 2024 at 6:18 PM Andi Kleen <a...@linux.intel.com> wrote:

From: Andi Kleen <a...@gcc.gnu.org>

Retrieving sys/user time in timevars is quite expensive because it
always needs a system call. Only getting the wall time is much
cheaper because operating systems have optimized paths for this.

The sys time isn't that interesting for a compiler and wall time
is usually close to user time except when the system is overloaded.
On the other hand when it is not wall time is more accurate because
it has less overhead.

For building tramp3d with -O0 the -ftime-report overhead drops from
18% to 3%. For -O2 it drops from 8% to not measurable.

I changed the code to use gettimeofday as a fallback for clock_gettime
CLOCK_MONOTONIC.  If a host has neither of those the time will not
be measured. Previously clock was the fallback.

OK for trunk if there's no serious objection until mid next week.

I committed the patch now.

I'm getting a build failure:

timevar.cc:163: undefined reference to `clock_gettime'

Our frozen build tools are intended to produce binaries that work "everywhere", so they're a few years old, but apparently something didn't configure correctly.

I see that libbacktrace configure correctly detects that clock_gettime is missing by default, but that it can be found in -lrt.

I'm investigating if I have a configuration problem on my end, but I think a configure test might be appropriate in gcc/configure, something like the one in the other subdirectories.

Andrew

Reply via email to