Details
-
Sub-task
-
Status: Resolved
-
Major
-
Resolution: Fixed
-
3.0.0-alpha1
-
None
Description
util/Timer.cc contains the following code:
clock_gettime(_POSIX_CPUTIME, &ts);
I'm not exactly sure what sort of time value this code is attempting to obtain (the process's on-CPU time perhaps?) but it is completely wrong, even on Linux. _POSIX_CPUTIME is a feature test macro and is not a valid parameter to clock_gettime. From the clock_gettime manpage:
The symbols _POSIX_MONOTONIC_CLOCK, _POSIX_CPUTIME, _POSIX_THREAD_CPUTIME indicate that CLOCK_MONOTONIC, CLOCK_PROCESS_CPUTIME_ID, CLOCK_THREAD_CPUTIME_ID are available
On my Linux distro the value of _POSIX_CPUTIME is defined as 0. That corresponds to
#define __CLOCK_REALTIME0 0 /* obsolete; same as CLOCK_REALTIME */
And CLOCK_REALTIME is
#define CLOCK_REALTIME 3 /* wall clock */
Which I suspect is not what is required here.
Getting cross-platform CPU time is fiddly, the following blog post has a good summary: http://nadeausoftware.com/articles/2012/03/c_c_tip_how_measure_cpu_time_benchmarking (code examples are CC licensed so should be no taint issues)
Attachments
Attachments
Issue Links
- relates to
-
YARN-3719 Improve Solaris support in YARN
- Open