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
-
=======================================================
Serassio Guido
Via Albenga, 11/4 10134 - Torino - ITALY
E-mail: [EMAIL PROTECTED]
WWW: http://www.serassio.it
Index: profiling.h
===================================================================
RCS file: /cvsroot/squid/squid3/include/profiling.h,v
retrieving revision 1.5
diff -u -p -r1.5 profiling.h
--- profiling.h 18 Nov 2002 03:12:54 -0000 1.5
+++ profiling.h 2 Feb 2003 13:14:54 -0000
@@ -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: util.h
===================================================================
RCS file: /cvsroot/squid/squid3/include/util.h,v
retrieving revision 1.7
diff -u -p -r1.7 util.h
--- util.h 27 Jan 2003 03:12:21 -0000 1.7
+++ util.h 2 Feb 2003 13:14:54 -0000
@@ -45,11 +45,13 @@
#endif
#if !defined(SQUIDHOSTNAMELEN)
+#ifndef _SQUID_MSWIN_
#include <sys/param.h>
#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 +70,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 +144,7 @@ SQUIDCEXTERN double xdiv(double nom, dou
SQUIDCEXTERN const char *xitoa(int num);
#if !HAVE_DRAND48
-double drand48(void);
+SQUIDCEXTERN double drand48(void);
#endif
typedef struct {
