[Python-checkins] CVS: python/dist/src/Modules _hotshot.c,1.4,1.5

Tim Peters tim_one@users.sourceforge.net
Sat, 13 Oct 2001 00:37:54 -0700


Update of /cvsroot/python/python/dist/src/Modules
In directory usw-pr-cvs1:/tmp/cvs-serv18461/python/Modules

Modified Files:
	_hotshot.c 
Log Message:
Speed the Windows code by using native 64-bit int compiler support instead
of calling external functions.


Index: _hotshot.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Modules/_hotshot.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** _hotshot.c	2001/10/13 00:14:28	1.4
--- _hotshot.c	2001/10/13 07:37:52	1.5
***************
*** 21,26 ****
  #include <largeint.h>
  #include <direct.h>    /* for getcwd() */
! typedef LARGE_INTEGER hs_time;
! #define GETTIMEOFDAY(p) QueryPerformanceCounter(p)
  
  #else
--- 21,30 ----
  #include <largeint.h>
  #include <direct.h>    /* for getcwd() */
! typedef __int64 hs_time;
! #define GETTIMEOFDAY(P_HS_TIME) \
! 	{ LARGE_INTEGER _temp; \
! 	  QueryPerformanceCounter(&_temp); \
! 	  *(P_HS_TIME) = _temp.QuadPart; }
! 	  
  
  #else
***************
*** 665,674 ****
  #ifdef MS_WIN32
      hs_time tv;
!     LARGE_INTEGER diff;
! 
!     QueryPerformanceCounter(&tv);
!     diff = LargeIntegerSubtract(tv, self->prev_timeofday);
  
!     tdelta = diff.LowPart;
  #else
      struct timeval tv;
--- 669,677 ----
  #ifdef MS_WIN32
      hs_time tv;
!     hs_time diff;
  
!     GETTIMEOFDAY(&tv);
!     diff = tv - self->prev_timeofday;
!     tdelta = (int)diff;
  #else
      struct timeval tv;
***************
*** 765,769 ****
  
  #ifdef MS_WIN32
!     LARGE_INTEGER diff;
      QueryPerformanceFrequency(&frequency);
  #endif
--- 768,772 ----
  
  #ifdef MS_WIN32
!     hs_time diff;
      QueryPerformanceFrequency(&frequency);
  #endif
***************
*** 773,779 ****
          GETTIMEOFDAY(&tv2);
  #ifdef MS_WIN32
!         diff = LargeIntegerSubtract(tv2, tv1);
!         if (!LargeIntegerEqualToZero(diff)) {
!             timeofday_diff = diff.LowPart;
              break;
          }
--- 776,782 ----
          GETTIMEOFDAY(&tv2);
  #ifdef MS_WIN32
!         diff = tv2 - tv1;
!         if (diff != 0) {
!             timeofday_diff = (unsigned long)diff;
              break;
          }