]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Summary: More windows code from Guido Serassio.
authorrobertc <>
Mon, 3 Feb 2003 05:04:13 +0000 (05:04 +0000)
committerrobertc <>
Mon, 3 Feb 2003 05:04:13 +0000 (05:04 +0000)
Keywords:

Hi,

This is the second of some splitted native Windows patches grouped by
functionality.

This patch add the native Windows support for profiling and fix some C++/C
include files problems.

Regards

Guido

include/profiling.h
include/util.h

index 5634b060e7e45776c96b688119e958e010ac8e85..d078bd5fc80e339b742099833b43d14059245ed8 100644 (file)
@@ -7,7 +7,7 @@
 #ifdef USE_XPROF_STATS
 
 #if !defined(_SQUID_SOLARIS_)
-typedef long long hrtime_t;
+typedef int64_t  hrtime_t;
 #else
 #include <sys/time.h>
 #endif
@@ -31,6 +31,19 @@ get_tick(void)
     asm volatile ("rpcc $0":"=A" (regs));      /* I'm not sure of syntax */
     return regs;
 }
+#elif defined(_M_IX86) && defined(_MSC_VER) /* x86 platform on Microsoft C Compiler ONLY */
+static __inline hrtime_t 
+get_tick(void)
+{
+    hrtime_t regs;
+    __asm {
+       cpuid
+       rdtsc
+       mov eax,DWORD PTR regs[0]
+       mov edx,DWORD PTR regs[4]
+    }
+    return regs;
+}
 #else
 #warning Unsupported CPU. Define function get_tick(). Disabling USE_XPROF_STATS...
 #undef USE_XPROF_STATS
@@ -98,7 +111,7 @@ struct _xprof_stats_data {
     hrtime_t best;
     hrtime_t worst;
     hrtime_t count;
-    long long summ;
+    int64_t summ;
 };
 
 struct _xprof_stats_node {
@@ -110,8 +123,8 @@ struct _xprof_stats_node {
 typedef xprof_stats_node TimersArray[1];
 
 /* public Data */
-extern TimersArray *xprof_Timers;
-extern int xprof_nesting;
+SQUIDCEXTERN TimersArray *xprof_Timers;
+SQUIDCEXTERN int xprof_nesting;
 
 /* Exported functions */
 SQUIDCEXTERN void xprof_start(xprof_type type, const char *timer);
index 24e779ef60e13bec2cb4a9372d305452c44f2977..5239d1a365a99e151b600aa5a95b32111404a44d 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $Id: util.h,v 1.68 2003/01/26 23:23:22 robertc Exp $
+ * $Id: util.h,v 1.69 2003/02/02 22:04:13 robertc Exp $
  *
  * AUTHOR: Harvest Derived
  *
 #endif
 
 #if !defined(SQUIDHOSTNAMELEN)
+#if HAVE_SYS_PARAM_H
 #include <sys/param.h>
+#endif
+#ifndef _SQUID_MSWIN_
 #ifndef _SQUID_NETDB_H_                /* need protection on NEXTSTEP */
 #define _SQUID_NETDB_H_
 #include <netdb.h>
 #endif
+#endif
 #if !defined(MAXHOSTNAMELEN) || (MAXHOSTNAMELEN < 128)
 #define SQUIDHOSTNAMELEN 128
 #else
@@ -68,7 +72,6 @@ SQUIDCEXTERN char *uudecode(const char *);
 SQUIDCEXTERN char *xstrdup(const char *);
 SQUIDCEXTERN char *xstrndup(const char *, size_t);
 SQUIDCEXTERN const char *xstrerror(void);
-extern const char *xbstrerror(int);
 SQUIDCEXTERN int tvSubMsec(struct timeval, struct timeval);
 SQUIDCEXTERN int tvSubUsec(struct timeval, struct timeval);
 SQUIDCEXTERN double tvSubDsec(struct timeval, struct timeval);
@@ -143,7 +146,7 @@ SQUIDCEXTERN double xdiv(double nom, double denom);
 SQUIDCEXTERN const char *xitoa(int num);
 
 #if !HAVE_DRAND48
-double drand48(void);
+SQUIDCEXTERN double drand48(void);
 #endif
 
 typedef struct {