From 60b68f0d39b92f329c4156a41866341d982831cb Mon Sep 17 00:00:00 2001 From: Christopher Faylor Date: Fri, 15 Feb 2002 17:06:40 +0000 Subject: * 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. --- winsup/cygwin/strace.cc | 34 ++++------------------------------ 1 file changed, 4 insertions(+), 30 deletions(-) (limited to 'winsup/cygwin/strace.cc') 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 -- cgit v1.2.3