diff options
author | Christopher Faylor <me@cgf.cx> | 2002-02-15 20:06:40 +0300 |
---|---|---|
committer | Christopher Faylor <me@cgf.cx> | 2002-02-15 20:06:40 +0300 |
commit | 60b68f0d39b92f329c4156a41866341d982831cb (patch) | |
tree | 69f77510cf9598ac24985d35427cc5457dcebe8d | |
parent | dce87b21e14f3a59d666cfe0a64261703c35d986 (diff) |
* hires.h (hires::usecs): Rename from utime. Accept an argument.
* strace.cc (strace::microseconds): Use hires class for calculating times.
* sync.h (new_muto): Use NO_COPY explicitly in declaration.
* times.cc (gettimeofday): Reflect change in usecs argument.
(hires::usecs): Ditto. Changed name from utime.
* winsup.h (NO_COPY): Add nocommon attribute to force setting aside space for
variable.
* regcomp.c (REQUIRE): Add a void cast to bypass a warning.
-rw-r--r-- | winsup/cygwin/ChangeLog | 12 | ||||
-rw-r--r-- | winsup/cygwin/hires.h | 4 | ||||
-rw-r--r-- | winsup/cygwin/regex/regcomp.c | 2 | ||||
-rw-r--r-- | winsup/cygwin/strace.cc | 34 | ||||
-rw-r--r-- | winsup/cygwin/sync.h | 2 | ||||
-rw-r--r-- | winsup/cygwin/times.cc | 8 | ||||
-rw-r--r-- | winsup/cygwin/winsup.h | 2 |
7 files changed, 25 insertions, 39 deletions
diff --git a/winsup/cygwin/ChangeLog b/winsup/cygwin/ChangeLog index 9275108d7..a880f3e8d 100644 --- a/winsup/cygwin/ChangeLog +++ b/winsup/cygwin/ChangeLog @@ -1,5 +1,17 @@ 2002-02-15 Christopher Faylor <cgf@redhat.com> + * hires.h (hires::usecs): Rename from utime. Accept an argument. + * strace.cc (strace::microseconds): Use hires class for calculating + times. + * sync.h (new_muto): Use NO_COPY explicitly in declaration. + * times.cc (gettimeofday): Reflect change in usecs argument. + (hires::usecs): Ditto. Changed name from utime. + * winsup.h (NO_COPY): Add nocommon attribute to force setting aside + space for variable. + * regcomp.c (REQUIRE): Add a void cast to bypass a warning. + +2002-02-15 Christopher Faylor <cgf@redhat.com> + * hires.h: New file. * times.cc (gettimeofday): Use hires class for calculating current time. (hires::prime): New method. diff --git a/winsup/cygwin/hires.h b/winsup/cygwin/hires.h index 06a00166d..c341aa287 100644 --- a/winsup/cygwin/hires.h +++ b/winsup/cygwin/hires.h @@ -17,8 +17,8 @@ class hires LARGE_INTEGER primed_ft; LARGE_INTEGER primed_pc; double freq; - void prime (); + void prime () __attribute__ ((regparm (1))); public: - LONGLONG utime (); + LONGLONG usecs (bool justdelta) __attribute__ ((regparm (2))); }; #endif /*__HIRES_H__*/ diff --git a/winsup/cygwin/regex/regcomp.c b/winsup/cygwin/regex/regcomp.c index 34c1f2e5c..52f9037de 100644 --- a/winsup/cygwin/regex/regcomp.c +++ b/winsup/cygwin/regex/regcomp.c @@ -52,7 +52,7 @@ static char nuls[10]; /* place to point scanner in event of error */ #define NEXTn(n) (p->next += (n)) #define GETNEXT() (*p->next++) #define SETERROR(e) seterr(p, (e)) -#define REQUIRE(co, e) ((co) || SETERROR(e)) +#define REQUIRE(co, e) (void) ((co) || SETERROR(e)) #define MUSTSEE(c, e) (REQUIRE(MORE() && PEEK() == (c), e)) #define MUSTEAT(c, e) (REQUIRE(MORE() && GETNEXT() == (c), e)) #define MUSTNOTSEE(c, e) (REQUIRE(!MORE() || PEEK() != (c), e)) diff --git a/winsup/cygwin/strace.cc b/winsup/cygwin/strace.cc index 00ad60139..a3a699327 100644 --- a/winsup/cygwin/strace.cc +++ b/winsup/cygwin/strace.cc @@ -19,6 +19,7 @@ details. */ #include "pinfo.h" #include "perprocess.h" #include "cygwin_version.h" +#include "hires.h" #define PROTECT(x) x[sizeof(x)-1] = 0 #define CHECK(x) if (x[sizeof(x)-1] != 0) { small_printf("array bound exceeded %d\n", __LINE__); ExitProcess(1); } @@ -61,37 +62,10 @@ strace::hello() } int -strace::microseconds() +strace::microseconds () { - static NO_COPY int first_microsec = 0; - static NO_COPY long long hires_frequency = 0; - static NO_COPY int hires_initted = 0; - - int microsec; - - if (!hires_initted) - { - hires_initted = 1; - QueryPerformanceFrequency ((LARGE_INTEGER *) &hires_frequency); - if (hires_frequency == 0) - hires_initted = 2; - } - if (hires_initted == 2) - { - int count = GetTickCount (); - microsec = count * 1000; - } - else - { - long long thiscount; - QueryPerformanceCounter ((LARGE_INTEGER *) &thiscount); - thiscount = (long long) (((double) thiscount/(double) hires_frequency) - * 1000000.0); - microsec = thiscount; - } - if (first_microsec == 0) - first_microsec = microsec; - return microsec - first_microsec; + static hires now; + return (int) now.usecs (true); } static int __stdcall diff --git a/winsup/cygwin/sync.h b/winsup/cygwin/sync.h index 756503d86..c710f8901 100644 --- a/winsup/cygwin/sync.h +++ b/winsup/cygwin/sync.h @@ -44,6 +44,6 @@ extern muto muto_start; /* Use a statically allocated buffer as the storage for a muto */ #define new_muto(__inh, __name) \ ({ \ - static muto __mbuf __attribute__((section(".data_cygwin_nocopy"))); \ + static muto __mbuf NO_COPY; \ __mbuf.init (__inh, __name); \ }) diff --git a/winsup/cygwin/times.cc b/winsup/cygwin/times.cc index a30374a54..032e32fb5 100644 --- a/winsup/cygwin/times.cc +++ b/winsup/cygwin/times.cc @@ -155,7 +155,7 @@ extern "C" int gettimeofday(struct timeval *tv, struct timezone *tz) { static hires gtod; - LONGLONG now = gtod.utime (); + LONGLONG now = gtod.usecs (false); if (now == (LONGLONG) -1) return -1; @@ -590,7 +590,7 @@ hires::prime () } LONGLONG -hires::utime () +hires::usecs (bool justdelta) { if (!inited) prime (); @@ -607,7 +607,7 @@ hires::utime () return -1; } - now.QuadPart -= primed_pc.QuadPart; // FIXME: Use round() here? - return primed_ft.QuadPart + (LONGLONG) ((double) now.QuadPart * freq); + now.QuadPart = (LONGLONG) (freq * (double) (now.QuadPart - primed_pc.QuadPart)); + return justdelta ? now.QuadPart : primed_ft.QuadPart + now.QuadPart; } diff --git a/winsup/cygwin/winsup.h b/winsup/cygwin/winsup.h index bf7315413..0adbb738c 100644 --- a/winsup/cygwin/winsup.h +++ b/winsup/cygwin/winsup.h @@ -23,7 +23,7 @@ details. */ # define memset __builtin_memset #endif -#define NO_COPY __attribute__((section(".data_cygwin_nocopy"))) +#define NO_COPY __attribute__((nocommon)) __attribute__((section(".data_cygwin_nocopy"))) #ifdef EXPCGF #define DECLARE_TLS_STORAGE char **tls[4096] __attribute__ ((unused)) |