* 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.
This commit is contained in:
parent
dce87b21e1
commit
60b68f0d39
@ -1,3 +1,15 @@
|
|||||||
|
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>
|
2002-02-15 Christopher Faylor <cgf@redhat.com>
|
||||||
|
|
||||||
* hires.h: New file.
|
* hires.h: New file.
|
||||||
|
@ -17,8 +17,8 @@ class hires
|
|||||||
LARGE_INTEGER primed_ft;
|
LARGE_INTEGER primed_ft;
|
||||||
LARGE_INTEGER primed_pc;
|
LARGE_INTEGER primed_pc;
|
||||||
double freq;
|
double freq;
|
||||||
void prime ();
|
void prime () __attribute__ ((regparm (1)));
|
||||||
public:
|
public:
|
||||||
LONGLONG utime ();
|
LONGLONG usecs (bool justdelta) __attribute__ ((regparm (2)));
|
||||||
};
|
};
|
||||||
#endif /*__HIRES_H__*/
|
#endif /*__HIRES_H__*/
|
||||||
|
@ -52,7 +52,7 @@ static char nuls[10]; /* place to point scanner in event of error */
|
|||||||
#define NEXTn(n) (p->next += (n))
|
#define NEXTn(n) (p->next += (n))
|
||||||
#define GETNEXT() (*p->next++)
|
#define GETNEXT() (*p->next++)
|
||||||
#define SETERROR(e) seterr(p, (e))
|
#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 MUSTSEE(c, e) (REQUIRE(MORE() && PEEK() == (c), e))
|
||||||
#define MUSTEAT(c, e) (REQUIRE(MORE() && GETNEXT() == (c), e))
|
#define MUSTEAT(c, e) (REQUIRE(MORE() && GETNEXT() == (c), e))
|
||||||
#define MUSTNOTSEE(c, e) (REQUIRE(!MORE() || PEEK() != (c), e))
|
#define MUSTNOTSEE(c, e) (REQUIRE(!MORE() || PEEK() != (c), e))
|
||||||
|
@ -19,6 +19,7 @@ details. */
|
|||||||
#include "pinfo.h"
|
#include "pinfo.h"
|
||||||
#include "perprocess.h"
|
#include "perprocess.h"
|
||||||
#include "cygwin_version.h"
|
#include "cygwin_version.h"
|
||||||
|
#include "hires.h"
|
||||||
|
|
||||||
#define PROTECT(x) x[sizeof(x)-1] = 0
|
#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); }
|
#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
|
int
|
||||||
strace::microseconds()
|
strace::microseconds ()
|
||||||
{
|
{
|
||||||
static NO_COPY int first_microsec = 0;
|
static hires now;
|
||||||
static NO_COPY long long hires_frequency = 0;
|
return (int) now.usecs (true);
|
||||||
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 int __stdcall
|
static int __stdcall
|
||||||
|
@ -44,6 +44,6 @@ extern muto muto_start;
|
|||||||
/* Use a statically allocated buffer as the storage for a muto */
|
/* Use a statically allocated buffer as the storage for a muto */
|
||||||
#define new_muto(__inh, __name) \
|
#define new_muto(__inh, __name) \
|
||||||
({ \
|
({ \
|
||||||
static muto __mbuf __attribute__((section(".data_cygwin_nocopy"))); \
|
static muto __mbuf NO_COPY; \
|
||||||
__mbuf.init (__inh, __name); \
|
__mbuf.init (__inh, __name); \
|
||||||
})
|
})
|
||||||
|
@ -155,7 +155,7 @@ extern "C" int
|
|||||||
gettimeofday(struct timeval *tv, struct timezone *tz)
|
gettimeofday(struct timeval *tv, struct timezone *tz)
|
||||||
{
|
{
|
||||||
static hires gtod;
|
static hires gtod;
|
||||||
LONGLONG now = gtod.utime ();
|
LONGLONG now = gtod.usecs (false);
|
||||||
if (now == (LONGLONG) -1)
|
if (now == (LONGLONG) -1)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
@ -590,7 +590,7 @@ hires::prime ()
|
|||||||
}
|
}
|
||||||
|
|
||||||
LONGLONG
|
LONGLONG
|
||||||
hires::utime ()
|
hires::usecs (bool justdelta)
|
||||||
{
|
{
|
||||||
if (!inited)
|
if (!inited)
|
||||||
prime ();
|
prime ();
|
||||||
@ -607,7 +607,7 @@ hires::utime ()
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
now.QuadPart -= primed_pc.QuadPart;
|
|
||||||
// FIXME: Use round() here?
|
// 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;
|
||||||
}
|
}
|
||||||
|
@ -23,7 +23,7 @@ details. */
|
|||||||
# define memset __builtin_memset
|
# define memset __builtin_memset
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define NO_COPY __attribute__((section(".data_cygwin_nocopy")))
|
#define NO_COPY __attribute__((nocommon)) __attribute__((section(".data_cygwin_nocopy")))
|
||||||
|
|
||||||
#ifdef EXPCGF
|
#ifdef EXPCGF
|
||||||
#define DECLARE_TLS_STORAGE char **tls[4096] __attribute__ ((unused))
|
#define DECLARE_TLS_STORAGE char **tls[4096] __attribute__ ((unused))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user