You are viewing a plain text version of this content. The canonical link for it is here.
Posted to mapreduce-dev@hadoop.apache.org by "Alan Burlison (JIRA)" <ji...@apache.org> on 2015/06/08 14:55:01 UTC
[jira] [Created] (MAPREDUCE-6391) util/Timer.cc completely
misunderstands _POSIX_CPUTIME
Alan Burlison created MAPREDUCE-6391:
----------------------------------------
Summary: util/Timer.cc completely misunderstands _POSIX_CPUTIME
Key: MAPREDUCE-6391
URL: https://issues.apache.org/jira/browse/MAPREDUCE-6391
Project: Hadoop Map/Reduce
Issue Type: Sub-task
Affects Versions: 2.7.0
Reporter: Alan Burlison
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:
bq. 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
bq. #define __CLOCK_REALTIME0 0 /* obsolete; same as CLOCK_REALTIME */
And CLOCK_REALTIME is
bq. #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)
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)