From: robertc <> Date: Mon, 3 Feb 2003 05:04:13 +0000 (+0000) Subject: Summary: More windows code from Guido Serassio. X-Git-Tag: SQUID_3_0_PRE1~401 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=2df6747c527980528b8bac3f8c680d994d33e844;p=thirdparty%2Fsquid.git Summary: More windows code from Guido Serassio. 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 --- diff --git a/include/profiling.h b/include/profiling.h index 5634b060e7..d078bd5fc8 100644 --- a/include/profiling.h +++ b/include/profiling.h @@ -7,7 +7,7 @@ #ifdef USE_XPROF_STATS #if !defined(_SQUID_SOLARIS_) -typedef long long hrtime_t; +typedef int64_t hrtime_t; #else #include #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); diff --git a/include/util.h b/include/util.h index 24e779ef60..5239d1a365 100644 --- a/include/util.h +++ b/include/util.h @@ -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 * @@ -45,11 +45,15 @@ #endif #if !defined(SQUIDHOSTNAMELEN) +#if HAVE_SYS_PARAM_H #include +#endif +#ifndef _SQUID_MSWIN_ #ifndef _SQUID_NETDB_H_ /* need protection on NEXTSTEP */ #define _SQUID_NETDB_H_ #include #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 {