Welcome to mirror list, hosted at ThFree Co, Russian Federation.

cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristopher Faylor <me@cgf.cx>2002-02-15 20:06:40 +0300
committerChristopher Faylor <me@cgf.cx>2002-02-15 20:06:40 +0300
commit60b68f0d39b92f329c4156a41866341d982831cb (patch)
tree69f77510cf9598ac24985d35427cc5457dcebe8d /winsup/cygwin/strace.cc
parentdce87b21e14f3a59d666cfe0a64261703c35d986 (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.
Diffstat (limited to 'winsup/cygwin/strace.cc')
-rw-r--r--winsup/cygwin/strace.cc34
1 files changed, 4 insertions, 30 deletions
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