[svn:parrot] r40533 - branches/pluggable_runcore/src/runcore

cotto at svn.parrot.org cotto at svn.parrot.org
Thu Aug 13 23:03:47 UTC 2009


Author: cotto
Date: Thu Aug 13 23:03:39 2009
New Revision: 40533
URL: https://trac.parrot.org/parrot/changeset/40533

Log:
[profiling] add modified patch from GeJ++ to make clock_gettime more portable across POSIXy platforms

Modified:
   branches/pluggable_runcore/src/runcore/cores.c

Modified: branches/pluggable_runcore/src/runcore/cores.c
==============================================================================
--- branches/pluggable_runcore/src/runcore/cores.c	Thu Aug 13 22:59:44 2009	(r40532)
+++ branches/pluggable_runcore/src/runcore/cores.c	Thu Aug 13 23:03:39 2009	(r40533)
@@ -258,6 +258,15 @@
 #  include "../jit.h"
 #endif
 
+#if defined(CLOCK_PROCESS_CPUTIME_ID)
+#  define CLOCK_BEST CLOCK_PROCESS_CPUTIME_ID
+#elif defined(CLOCK_PROF)
+#  define CLOCK_BEST CLOCK_PROF
+#else
+#  define CLOCK_BEST CLOCK_REALTIME
+#endif
+
+
 /* HEADERIZER HFILE: include/parrot/runcore_api.h */
 
 /* HEADERIZER BEGIN: static */
@@ -1066,9 +1075,9 @@
         CONTEXT(interp)->current_pc = pc;
         prev_ctx = CONTEXT(interp);
         prev_pc = pc;
-        clock_gettime(CLOCK_PROCESS_CPUTIME_ID, &preop);
+        clock_gettime(CLOCK_BEST, &preop);
         DO_OP(pc, interp);
-        clock_gettime(CLOCK_PROCESS_CPUTIME_ID, &postop);
+        clock_gettime(CLOCK_BEST, &postop);
 
         op_time = (postop.tv_sec * 1000*1000*1000 + postop.tv_nsec) -
                   (preop.tv_sec  * 1000*1000*1000 + preop.tv_nsec);


More information about the parrot-commits mailing list