[svn:parrot] r40822 - in branches/pluggable_runcore/config: gen/makefiles gen/platform/generic init init/hints

cotto at svn.parrot.org cotto at svn.parrot.org
Thu Aug 27 02:18:40 UTC 2009


Author: cotto
Date: Thu Aug 27 02:18:39 2009
New Revision: 40822
URL: https://trac.parrot.org/parrot/changeset/40822

Log:
[config] use hints instead of #defines to try to figure out the best available timing method
A configure step that probes different values until one works would be ideal, but this is much easier.
darbelo++ for putting together most of the patch

Modified:
   branches/pluggable_runcore/config/gen/makefiles/root.in
   branches/pluggable_runcore/config/gen/platform/generic/hires_timer.c
   branches/pluggable_runcore/config/init/defaults.pm
   branches/pluggable_runcore/config/init/hints/linux.pm
   branches/pluggable_runcore/config/init/hints/mswin32.pm
   branches/pluggable_runcore/config/init/hints/openbsd.pm
   branches/pluggable_runcore/config/init/hints/solaris.pm

Modified: branches/pluggable_runcore/config/gen/makefiles/root.in
==============================================================================
--- branches/pluggable_runcore/config/gen/makefiles/root.in	Thu Aug 27 02:13:48 2009	(r40821)
+++ branches/pluggable_runcore/config/gen/makefiles/root.in	Thu Aug 27 02:18:39 2009	(r40822)
@@ -103,7 +103,7 @@
 CC_INC           := @cc_inc@
 C_LIBS           := @libs@
 CC_SHARED        := @cc_shared@
-CFLAGS           := $(CC_INC) @ccflags@ @cc_debug@ @ccwarn@ @cc_hasjit@ @cg_flag@ @gc_flag@ $(CC_SHARED)
+CFLAGS           := $(CC_INC) @ccflags@ @cc_debug@ @ccwarn@ @cc_hasjit@ @cg_flag@ @gc_flag@ @clock_best@ $(CC_SHARED)
 LINK_DYNAMIC     := @link_dynamic@
 LINK             := @link@
 LINKFLAGS        := @linkflags@ @link_debug@ @ld_debug@

Modified: branches/pluggable_runcore/config/gen/platform/generic/hires_timer.c
==============================================================================
--- branches/pluggable_runcore/config/gen/platform/generic/hires_timer.c	Thu Aug 27 02:13:48 2009	(r40821)
+++ branches/pluggable_runcore/config/gen/platform/generic/hires_timer.c	Thu Aug 27 02:18:39 2009	(r40822)
@@ -24,21 +24,6 @@
 #include <time.h>
 #include "parrot/platform.h"
 
-
-/* Using real time can introduce error.  Hopefully all platforms will have
- * hints that specify a more useful clock.
- */
-
-#ifndef CLOCK_BEST
-#  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
-#endif
-
 #define TIME_IN_NS(n) ((n).tv_sec * 1000*1000*1000 + (n).tv_nsec)
 
 /*

Modified: branches/pluggable_runcore/config/init/defaults.pm
==============================================================================
--- branches/pluggable_runcore/config/init/defaults.pm	Thu Aug 27 02:13:48 2009	(r40821)
+++ branches/pluggable_runcore/config/init/defaults.pm	Thu Aug 27 02:18:39 2009	(r40822)
@@ -256,6 +256,9 @@
         );
     }
 
+    #clock_id used to call the clock_gettime() in the profiling runcore.
+    $conf->data->set( clock_best => '-DCLOCK_BEST=CLOCK_PROF' );
+
     $conf->data->set( 'archname', $Config{archname});
     # adjust archname, cc and libs for e.g. --m=32
     # RT#41499 this is maybe gcc only

Modified: branches/pluggable_runcore/config/init/hints/linux.pm
==============================================================================
--- branches/pluggable_runcore/config/init/hints/linux.pm	Thu Aug 27 02:13:48 2009	(r40821)
+++ branches/pluggable_runcore/config/init/hints/linux.pm	Thu Aug 27 02:18:39 2009	(r40822)
@@ -152,6 +152,8 @@
         libparrot_soname       => "-Wl,-soname=libparrot$share_ext.$version",
     );
 
+    $conf->data->set( clock_best => '-DCLOCK_BEST=CLOCK_PROCESS_CPUTIME_ID' );
+
      if ( ( split( m/-/, $conf->data->get_p5('archname'), 2 ) )[0] eq 'ia64' ) {
 
         $conf->data->set( platform_asm => 1 );

Modified: branches/pluggable_runcore/config/init/hints/mswin32.pm
==============================================================================
--- branches/pluggable_runcore/config/init/hints/mswin32.pm	Thu Aug 27 02:13:48 2009	(r40821)
+++ branches/pluggable_runcore/config/init/hints/mswin32.pm	Thu Aug 27 02:18:39 2009	(r40822)
@@ -45,6 +45,8 @@
         $conf->data->set( bindir => Win32::GetShortPathName($bindir) );
     }
 
+    $conf->data->set( clock_best => ' ' );
+
     if ($is_msvc) {
         my $msvcversion = $conf->data->get('msvcversion');
 

Modified: branches/pluggable_runcore/config/init/hints/openbsd.pm
==============================================================================
--- branches/pluggable_runcore/config/init/hints/openbsd.pm	Thu Aug 27 02:13:48 2009	(r40821)
+++ branches/pluggable_runcore/config/init/hints/openbsd.pm	Thu Aug 27 02:18:39 2009	(r40822)
@@ -37,6 +37,7 @@
         $conf->data->set( as => 'as -mregnames' );
     }
 
+    $conf->data->set( clock_best => '-DCLOCK_BEST=CLOCK_MONOTONIC' );
 }
 
 1;

Modified: branches/pluggable_runcore/config/init/hints/solaris.pm
==============================================================================
--- branches/pluggable_runcore/config/init/hints/solaris.pm	Thu Aug 27 02:13:48 2009	(r40821)
+++ branches/pluggable_runcore/config/init/hints/solaris.pm	Thu Aug 27 02:18:39 2009	(r40822)
@@ -17,6 +17,7 @@
         $libs .= ' -lrt';    # Needed for sched_yield.
     }
     $conf->data->set( libs => $libs );
+    $conf->data->set( clock_best => '-DCLOCK_BEST=CLOCK_PROCESS_CPUTIME_ID' );
 
     ################################################################
     # If we're going to be using ICU (or any other C++-compiled library) we


More information about the parrot-commits mailing list