LLNL / llnl-hires-timers

C library containing high resolution timer implementation for several platforms.
Other
10 stars 1 forks source link

Suggestion for optimization #3

Open alehaa opened 7 years ago

alehaa commented 7 years ago

To minimize the overhead of this code I'd like to suggest some optimizations on the code:

Instead of managing a full library for this job, I'd like to suggest to extend clock_gettime() and clock_getres() (POSIX.1-2001). As far as I know these functions provide the maximum precise timers on each platform, but are not optimized for BlueGene systems.

In the GNU C library, clock_gettime() and clock_getres() are weak symbols, so my approach would be to restructure the code for providing these symbols for BlueGene high precision timers. A benefit would be to use the same code for "normal" hardware and BlueGene without much changes ion the code, just linking against this library to get high precision timers instead of low precision.

alehaa commented 7 years ago

It seems that the weak attribute on clock_gettime() is not consistent over all platforms. To solve this issue, a minimal header could be included to redirect clock_gettime() to e.g. clock_gettime_bgq() on supported platforms, so no change of the source code is needed but to give the user a maximum of flexibility.