[PATCH][RFC] Add the ability to record sub-timevars (-ftime-report-details)

Alexander Monakov amonakov@ispras.ru
Wed Aug 10 14:14:00 GMT 2016

On Wed, 10 Aug 2016, David Malcolm wrote:
> Looks like inside a pop there's a lazy allocation of a map, and a
> get_or_insert.  Could this make -ftime-report have an impact on the
> timing?

-ftime-report already has a great impact on timing because it adds a syscall on
each timevar change (which happens thousands of times). It's possible to diminish
that impact by using a time measuring facility that can go through just the vDSO
on Linux (e.g. clock_gettime), but that wouldn't make split user/kernel timing
available, and on old glibc versions you get clock_gettime only with -lrt.

On a random translation unit of about 1800 sloc the impact of -ftime report is:

w/o -ftime-report    with -ftime-report
real    0m0.456s     real    0m0.544s
user    0m0.447s     user    0m0.464s
sys     0m0.009s     sys     0m0.079s


More information about the Gcc-patches mailing list