[Orca-checkins] r269 - in trunk/orca: . packages/Time-HiRes-1.52 packages/Time-HiRes-1.55 packages/Time-HiRes-1.55/hints

Blair Zajac blair at orcaware.com
Thu Jan 15 13:43:40 PST 2004


Author: blair
Date: Thu Jan 15 13:43:22 2004
New Revision: 269

Added:
   trunk/orca/packages/Time-HiRes-1.55/
      - copied from r268, trunk/orca/packages/Time-HiRes-1.52/
   trunk/orca/packages/Time-HiRes-1.55/hints/solaris.pl
Removed:
   trunk/orca/packages/Time-HiRes-1.52/
Modified:
   trunk/orca/INSTALL
   trunk/orca/configure.in
   trunk/orca/packages/Time-HiRes-1.55/Changes
   trunk/orca/packages/Time-HiRes-1.55/HiRes.pm
   trunk/orca/packages/Time-HiRes-1.55/HiRes.xs
   trunk/orca/packages/Time-HiRes-1.55/MANIFEST
   trunk/orca/packages/Time-HiRes-1.55/META.yml
Log:
Upgrade Time::HiRes from 1.52 to 1.55.

* INSTALL (Determine which Perl modules need compiling and installing):
  Update all references to Time::HiRes's version number from 1.52 to
  1.55.

* configure.in:
  Bump Time::HiRes's version number to 1.55.

* packages/Time-HiRes-1.55:
  Renamed from packages/Time-HiRes-1.52.  Directory contents updated
  from Time-HiRes-1.55.tar.gz.


Modified: trunk/orca/INSTALL
==============================================================================
--- trunk/orca/INSTALL	(original)
+++ trunk/orca/INSTALL	Thu Jan 15 13:43:22 2004
@@ -177,7 +177,7 @@
     Math::IntervalSearch    >= 1.05        >= 1.05      1.05
     RRDs                    >= 1.000451    >= 1.0.45    1.0.45
     Storable                >= 2.09        >= 2.09      2.09
-    Time::HiRes             Not required by Orca        1.52
+    Time::HiRes             Not required by Orca        1.55
 
     All seven of these modules are included with the Orca distribution
     in the packages directory.  When you configure Orca in step 3),
@@ -278,10 +278,10 @@
 
     Time::HiRes
 
-      http://www.perl.com/CPAN/authors/id/J/JH/JHI/Time-HiRes-1.52.tar.gz
+      http://www.perl.com/CPAN/authors/id/J/JH/JHI/Time-HiRes-1.55.tar.gz
 
-      % gunzip -c Time-HiRes-1.52.tar.gz | tar xvf -
-      % cd Time-HiRes-1.52
+      % gunzip -c Time-HiRes-1.55.tar.gz | tar xvf -
+      % cd Time-HiRes-1.55
       % perl Makefile.PL
       % make
       % make test

Modified: trunk/orca/configure.in
==============================================================================
--- trunk/orca/configure.in	(original)
+++ trunk/orca/configure.in	Thu Jan 15 13:43:22 2004
@@ -41,8 +41,8 @@
 RRDTOOL_VER=1.000451
 STORABLE_DIR=Storable-2.09
 STORABLE_VER=2.09
-TIME_HIRES_DIR=Time-HiRes-1.52
-TIME_HIRES_VER=1.52
+TIME_HIRES_DIR=Time-HiRes-1.55
+TIME_HIRES_VER=1.55
 
 AC_SUBST(COMPRESS_ZLIB_DIR)
 AC_SUBST(DATA_DUMPER_DIR)

Modified: trunk/orca/packages/Time-HiRes-1.55/Changes
==============================================================================
--- trunk/orca/packages/Time-HiRes-1.52/Changes	(original)
+++ trunk/orca/packages/Time-HiRes-1.55/Changes	Thu Jan 15 13:43:22 2004
@@ -1,5 +1,19 @@
 Revision history for Perl extension Time::HiRes.
 
+1.55
+	- Windows: ming32 patch from Mike Pomraning (use Perl's Const64()
+	  instead of VC-specific i64 suffix)
+
+1.54
+	- Solaris: like Tru64 (dec_osf) also Solaris need -lrt for nanosleep
+
+1.53
+	- Windows: higher resolution time() by using the Windows
+	  performance counter API, from Jan Dubois and Anton Shcherbinin.
+	  The exact new higher resolution depends on the hardware,
+	  but it should be quite a bit better than using the basic
+	  Windows timers.
+
 1.52
 	- In AIX (v?) with perl 5.6.1 the HiRes.t can hang after
 	  the subtest 18.  No known analysis nor fix, but added

Modified: trunk/orca/packages/Time-HiRes-1.55/HiRes.pm
==============================================================================
--- trunk/orca/packages/Time-HiRes-1.52/HiRes.pm	(original)
+++ trunk/orca/packages/Time-HiRes-1.55/HiRes.pm	Thu Jan 15 13:43:22 2004
@@ -15,7 +15,7 @@
 		 d_usleep d_ualarm d_gettimeofday d_getitimer d_setitimer
 		 d_nanosleep);
 	
-$VERSION = '1.52';
+$VERSION = '1.55';
 $XS_VERSION = $VERSION;
 $VERSION = eval $VERSION;
 
@@ -343,7 +343,7 @@
 
 Copyright (c) 1996-2002 Douglas E. Wegscheid.  All rights reserved.
 
-Copyright (c) 2002,2003 Jarkko Hietaniemi.  All rights reserved.
+Copyright (c) 2002,2003,2004 Jarkko Hietaniemi.  All rights reserved.
 
 This program is free software; you can redistribute it and/or modify
 it under the same terms as Perl itself.

Modified: trunk/orca/packages/Time-HiRes-1.55/HiRes.xs
==============================================================================
--- trunk/orca/packages/Time-HiRes-1.52/HiRes.xs	(original)
+++ trunk/orca/packages/Time-HiRes-1.55/HiRes.xs	Thu Jan 15 13:43:22 2004
@@ -1,6 +1,7 @@
 #ifdef __cplusplus
 extern "C" {
 #endif
+#define PERL_NO_GET_CONTEXT
 #include "EXTERN.h"
 #include "perl.h"
 #include "XSUB.h"
@@ -18,10 +19,34 @@
 }
 #endif
 
+#ifndef NOOP
+#    define NOOP (void)0
+#endif
+#ifndef dNOOP
+#    define dNOOP extern int Perl___notused
+#endif
+
 #ifndef aTHX_
 #    define aTHX_
 #    define pTHX_
-#endif         
+#    define dTHX dNOOP
+#endif
+
+#ifdef START_MY_CXT
+#  ifndef MY_CXT_CLONE
+#    define MY_CXT_CLONE                                                \
+	dMY_CXT_SV;							\
+	my_cxt_t *my_cxtp = (my_cxt_t*)SvPVX(newSV(sizeof(my_cxt_t)-1));\
+	Copy(INT2PTR(my_cxt_t*, SvUV(my_cxt_sv)), my_cxtp, 1, my_cxt_t); \
+	sv_setuv(my_cxt_sv, PTR2UV(my_cxtp))
+#  endif
+#else
+#    define START_MY_CXT static my_cxt_t my_cxt;
+#    define dMY_CXT	 dNOOP
+#    define MY_CXT_INIT	 NOOP
+#    define MY_CXT_CLONE NOOP
+#    define MY_CXT	 my_cxt
+#endif
 
 #ifndef NVTYPE
 #   if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
@@ -110,8 +135,11 @@
 
 #include "const-c.inc"
 
-#if !defined(HAS_GETTIMEOFDAY) && defined(WIN32)
-#define HAS_GETTIMEOFDAY
+#ifdef WIN32
+
+#ifndef HAS_GETTIMEOFDAY
+#   define HAS_GETTIMEOFDAY
+#endif
 
 /* shows up in winsock.h?
 struct timeval {
@@ -125,6 +153,17 @@
     FILETIME		ft_val;
 } FT_t;
 
+#define MY_CXT_KEY "Time::HiRes_" XS_VERSION
+
+typedef struct {
+    unsigned long run_count;
+    unsigned __int64 base_ticks;
+    unsigned __int64 tick_frequency;
+    FT_t base_systime_as_filetime;
+} my_cxt_t;
+
+START_MY_CXT
+
 /* Number of 100 nanosecond units from 1/1/1601 to 1/1/1970 */
 #ifdef __GNUC__
 #define Const64(x) x##LL
@@ -135,13 +174,34 @@
 
 /* NOTE: This does not compute the timezone info (doing so can be expensive,
  * and appears to be unsupported even by glibc) */
-int
-gettimeofday (struct timeval *tp, void *not_used)
+
+/* dMY_CXT needs a Perl context and we don't want to call PERL_GET_CONTEXT
+   for performance reasons */
+
+#undef gettimeofday
+#define gettimeofday(tp, not_used) _gettimeofday(aTHX_ tp, not_used)
+
+static int
+_gettimeofday(pTHX_ struct timeval *tp, void *not_used)
 {
+    dMY_CXT;
+
+    unsigned __int64 ticks;
     FT_t ft;
 
-    /* this returns time in 100-nanosecond units  (i.e. tens of usecs) */
-    GetSystemTimeAsFileTime(&ft.ft_val);
+    if (MY_CXT.run_count++) {
+        QueryPerformanceCounter((LARGE_INTEGER*)&ticks);
+        ticks -= MY_CXT.base_ticks;
+        ft.ft_i64 = MY_CXT.base_systime_as_filetime.ft_i64
+                    + Const64(10000000) * (ticks / MY_CXT.tick_frequency)
+                    +(Const64(10000000) * (ticks % MY_CXT.tick_frequency)) / MY_CXT.tick_frequency;
+    }
+    else {
+        QueryPerformanceFrequency((LARGE_INTEGER*)&MY_CXT.tick_frequency);
+        QueryPerformanceCounter((LARGE_INTEGER*)&MY_CXT.base_ticks);
+        GetSystemTimeAsFileTime(&MY_CXT.base_systime_as_filetime.ft_val);
+        ft.ft_i64 = MY_CXT.base_systime_as_filetime.ft_i64;
+    }
 
     /* seconds since epoch */
     tp->tv_sec = (long)((ft.ft_i64 - EPOCH_BIAS) / Const64(10000000));
@@ -153,6 +213,15 @@
 }
 #endif
 
+#if defined(WIN32) && !defined(ATLEASTFIVEOHOHFIVE)
+static unsigned int
+sleep(unsigned int t)
+{
+    Sleep(t*1000);
+    return 0;
+}
+#endif
+
 #if !defined(HAS_GETTIMEOFDAY) && defined(VMS)
 #define HAS_GETTIMEOFDAY
 
@@ -605,7 +674,7 @@
 #ifdef HAS_GETTIMEOFDAY
 
 static int
-myU2time(UV *ret)
+myU2time(pTHX_ UV *ret)
 {
   struct timeval Tp;
   int status;
@@ -618,6 +687,9 @@
 static NV
 myNVtime()
 {
+#ifdef WIN32
+    dTHX;
+#endif
   struct timeval Tp;
   int status;
   status = gettimeofday (&Tp, NULL);
@@ -631,15 +703,29 @@
 PROTOTYPES: ENABLE
 
 BOOT:
+{
+#ifdef MY_CXT_KEY
+  MY_CXT_INIT;
+#endif
 #ifdef ATLEASTFIVEOHOHFIVE
 #ifdef HAS_GETTIMEOFDAY
-{
-  UV auv[2];
-  hv_store(PL_modglobal, "Time::NVtime", 12, newSViv(PTR2IV(myNVtime)), 0);
-  if (myU2time(auv) == 0)
-    hv_store(PL_modglobal, "Time::U2time", 12, newSViv((IV) auv[0]), 0);
-}
+  {
+    UV auv[2];
+    hv_store(PL_modglobal, "Time::NVtime", 12, newSViv(PTR2IV(myNVtime)), 0);
+    if (myU2time(aTHX_ auv) == 0)
+      hv_store(PL_modglobal, "Time::U2time", 12, newSViv((IV) auv[0]), 0);
+  }
+#endif
 #endif
+}
+
+#if defined(USE_ITHREADS) && defined(MY_CXT_KEY)
+
+void
+CLONE(...)
+    CODE:
+    MY_CXT_CLONE;
+
 #endif
 
 INCLUDE: const-xs.inc

Modified: trunk/orca/packages/Time-HiRes-1.55/MANIFEST
==============================================================================
--- trunk/orca/packages/Time-HiRes-1.52/MANIFEST	(original)
+++ trunk/orca/packages/Time-HiRes-1.55/MANIFEST	Thu Jan 15 13:43:22 2004
@@ -5,6 +5,7 @@
 hints/dynixptx.pl	Hints for Time::HiRes for named architecture
 hints/irix.pl		Hints for Time::HiRes for named architecture
 hints/sco.pl		Hints for Time::HiRes for named architecture
+hints/solaris.pl	Hints for Time::HiRes for named architecture
 hints/svr4.pl		Hints for Time::HiRes for named architecture
 HiRes.pm		Time::HiRes extension
 t/HiRes.t		Test for Time::HiRes

Modified: trunk/orca/packages/Time-HiRes-1.55/META.yml
==============================================================================
--- trunk/orca/packages/Time-HiRes-1.52/META.yml	(original)
+++ trunk/orca/packages/Time-HiRes-1.55/META.yml	Thu Jan 15 13:43:22 2004
@@ -1,7 +1,7 @@
 # http://module-build.sourceforge.net/META-spec.html
 #XXXXXXX This is a prototype!!!  It will change in the future!!! XXXXX#
 name:         Time-HiRes
-version:      1.52
+version:      1.55
 version_from: HiRes.pm
 installdirs:  perl
 requires:

Added: trunk/orca/packages/Time-HiRes-1.55/hints/solaris.pl
==============================================================================
--- (empty file)
+++ trunk/orca/packages/Time-HiRes-1.55/hints/solaris.pl	Thu Jan 15 13:43:22 2004
@@ -0,0 +1,3 @@
+# needs to explicitly link against librt to pull in nanosleep
+$self->{LIBS} = ['-lrt'];
+



More information about the Orca-checkins mailing list