summaryrefslogtreecommitdiff
path: root/contrib/testzlib/testzlib.c
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/testzlib/testzlib.c')
-rw-r--r--contrib/testzlib/testzlib.c33
1 files changed, 25 insertions, 8 deletions
diff --git a/contrib/testzlib/testzlib.c b/contrib/testzlib/testzlib.c
index 6c3ff9f..e5574f4 100644
--- a/contrib/testzlib/testzlib.c
+++ b/contrib/testzlib/testzlib.c
@@ -1,7 +1,7 @@
1
2#include <stdio.h> 1#include <stdio.h>
3#include <stdlib.h> 2#include <stdlib.h>
4#include <windows.h> 3#include <windows.h>
4
5#include "zlib.h" 5#include "zlib.h"
6 6
7 7
@@ -17,23 +17,25 @@ void MyDoMinus64(LARGE_INTEGER *R,LARGE_INTEGER A,LARGE_INTEGER B)
17 } 17 }
18} 18}
19 19
20#ifdef _AMD64_ 20#ifdef _M_X64
21unsigned _int64 myrdtsc(); 21// see http://msdn2.microsoft.com/library/twchhe95(en-us,vs.80).aspx for __rdtsc
22unsigned __int64 __rdtsc(void);
22void BeginCountRdtsc(LARGE_INTEGER * pbeginTime64) 23void BeginCountRdtsc(LARGE_INTEGER * pbeginTime64)
23{ 24{
24 // printf("rdtsc = %I64x\n",myrdtsc()); 25 // printf("rdtsc = %I64x\n",__rdtsc());
25 pbeginTime64->QuadPart=myrdtsc(); 26 pbeginTime64->QuadPart=__rdtsc();
26} 27}
27 28
28LARGE_INTEGER GetResRdtsc(LARGE_INTEGER beginTime64,BOOL fComputeTimeQueryPerf) 29LARGE_INTEGER GetResRdtsc(LARGE_INTEGER beginTime64,BOOL fComputeTimeQueryPerf)
29{ 30{
30 LARGE_INTEGER LIres; 31 LARGE_INTEGER LIres;
31 unsigned _int64 res=myrdtsc()-((unsigned _int64)(beginTime64.QuadPart)); 32 unsigned _int64 res=__rdtsc()-((unsigned _int64)(beginTime64.QuadPart));
32 LIres.QuadPart=res; 33 LIres.QuadPart=res;
33 // printf("rdtsc = %I64x\n",myrdtsc()); 34 // printf("rdtsc = %I64x\n",__rdtsc());
34 return LIres; 35 return LIres;
35} 36}
36#else 37#else
38#ifdef _M_IX86
37void myGetRDTSC32(LARGE_INTEGER * pbeginTime64) 39void myGetRDTSC32(LARGE_INTEGER * pbeginTime64)
38{ 40{
39 DWORD dwEdx,dwEax; 41 DWORD dwEdx,dwEax;
@@ -61,8 +63,23 @@ LARGE_INTEGER GetResRdtsc(LARGE_INTEGER beginTime64,BOOL fComputeTimeQueryPerf)
61 MyDoMinus64(&LIres,endTime64,beginTime64); 63 MyDoMinus64(&LIres,endTime64,beginTime64);
62 return LIres; 64 return LIres;
63} 65}
64#endif 66#else
67void myGetRDTSC32(LARGE_INTEGER * pbeginTime64)
68{
69}
70
71void BeginCountRdtsc(LARGE_INTEGER * pbeginTime64)
72{
73}
65 74
75LARGE_INTEGER GetResRdtsc(LARGE_INTEGER beginTime64,BOOL fComputeTimeQueryPerf)
76{
77 LARGE_INTEGER lr;
78 lr.QuadPart=0;
79 return lr;
80}
81#endif
82#endif
66 83
67void BeginCountPerfCounter(LARGE_INTEGER * pbeginTime64,BOOL fComputeTimeQueryPerf) 84void BeginCountPerfCounter(LARGE_INTEGER * pbeginTime64,BOOL fComputeTimeQueryPerf)
68{ 85{