- renamed s_gettime => S_gettime to remain consistent with the
convention that the only undocumented externs are prefixed with S_. externs.h, stats.c, thread.c original commit: 898c3941d807a18c393a4575a72283e3671ee7e5
This commit is contained in:
parent
69455857d2
commit
e5ee788d6f
4
LOG
4
LOG
|
@ -588,3 +588,7 @@
|
||||||
cp0.ss
|
cp0.ss
|
||||||
primdata.ss
|
primdata.ss
|
||||||
fx.ms
|
fx.ms
|
||||||
|
- renamed s_gettime => S_gettime to remain consistent with the
|
||||||
|
convention that the only undocumented externs are prefixed with
|
||||||
|
S_.
|
||||||
|
externs.h, stats.c, thread.c
|
||||||
|
|
|
@ -321,7 +321,7 @@ extern ptr S_gmtime PROTO((ptr tzoff, ptr tspair));
|
||||||
extern ptr S_asctime PROTO((ptr dtvec));
|
extern ptr S_asctime PROTO((ptr dtvec));
|
||||||
extern ptr S_mktime PROTO((ptr dtvec));
|
extern ptr S_mktime PROTO((ptr dtvec));
|
||||||
extern ptr S_unique_id PROTO((void));
|
extern ptr S_unique_id PROTO((void));
|
||||||
extern void s_gettime PROTO((INT typeno, struct timespec *tp));
|
extern void S_gettime PROTO((INT typeno, struct timespec *tp));
|
||||||
|
|
||||||
/* symbol.c */
|
/* symbol.c */
|
||||||
extern ptr S_symbol_value PROTO((ptr sym));
|
extern ptr S_symbol_value PROTO((ptr sym));
|
||||||
|
|
22
c/stats.c
22
c/stats.c
|
@ -119,7 +119,7 @@ typedef void (WINAPI *GetSystemTimeAsFileTime_t)(LPFILETIME lpSystemTimeAsFileTi
|
||||||
|
|
||||||
static GetSystemTimeAsFileTime_t s_GetSystemTimeAsFileTime = GetSystemTimeAsFileTime;
|
static GetSystemTimeAsFileTime_t s_GetSystemTimeAsFileTime = GetSystemTimeAsFileTime;
|
||||||
|
|
||||||
void s_gettime(INT typeno, struct timespec *tp) {
|
void S_gettime(INT typeno, struct timespec *tp) {
|
||||||
switch (typeno) {
|
switch (typeno) {
|
||||||
case time_process: {
|
case time_process: {
|
||||||
FILETIME ftKernel, ftUser, ftDummy;
|
FILETIME ftKernel, ftUser, ftDummy;
|
||||||
|
@ -205,7 +205,7 @@ void s_gettime(INT typeno, struct timespec *tp) {
|
||||||
}
|
}
|
||||||
|
|
||||||
default:
|
default:
|
||||||
S_error1("s_gettime", "unexpected typeno ~s", Sinteger(typeno));
|
S_error1("S_gettime", "unexpected typeno ~s", Sinteger(typeno));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -228,7 +228,7 @@ static char *asctime_r(const struct tm *tm, char *buf) {
|
||||||
|
|
||||||
#else /* WIN32 */
|
#else /* WIN32 */
|
||||||
|
|
||||||
void s_gettime(INT typeno, struct timespec *tp) {
|
void S_gettime(INT typeno, struct timespec *tp) {
|
||||||
switch (typeno) {
|
switch (typeno) {
|
||||||
case time_thread:
|
case time_thread:
|
||||||
#ifdef CLOCK_THREAD_CPUTIME_ID
|
#ifdef CLOCK_THREAD_CPUTIME_ID
|
||||||
|
@ -244,7 +244,7 @@ void s_gettime(INT typeno, struct timespec *tp) {
|
||||||
struct rusage rbuf;
|
struct rusage rbuf;
|
||||||
|
|
||||||
if (getrusage(RUSAGE_SELF,&rbuf) != 0)
|
if (getrusage(RUSAGE_SELF,&rbuf) != 0)
|
||||||
S_error1("s_gettime", "failed: ~s", S_strerror(errno));
|
S_error1("S_gettime", "failed: ~s", S_strerror(errno));
|
||||||
tp->tv_sec = rbuf.ru_utime.tv_sec + rbuf.ru_stime.tv_sec;
|
tp->tv_sec = rbuf.ru_utime.tv_sec + rbuf.ru_stime.tv_sec;
|
||||||
tp->tv_nsec = (rbuf.ru_utime.tv_usec + rbuf.ru_stime.tv_usec) * 1000;
|
tp->tv_nsec = (rbuf.ru_utime.tv_usec + rbuf.ru_stime.tv_usec) * 1000;
|
||||||
if (tp->tv_nsec >= 1000000000) {
|
if (tp->tv_nsec >= 1000000000) {
|
||||||
|
@ -277,13 +277,13 @@ void s_gettime(INT typeno, struct timespec *tp) {
|
||||||
struct timeval tvtp;
|
struct timeval tvtp;
|
||||||
|
|
||||||
if (gettimeofday(&tvtp,NULL) != 0)
|
if (gettimeofday(&tvtp,NULL) != 0)
|
||||||
S_error1("s_gettime", "failed: ~s", S_strerror(errno));
|
S_error1("S_gettime", "failed: ~s", S_strerror(errno));
|
||||||
tp->tv_sec = (time_t)tvtp.tv_sec;
|
tp->tv_sec = (time_t)tvtp.tv_sec;
|
||||||
tp->tv_nsec = (long)(tvtp.tv_usec * 1000);
|
tp->tv_nsec = (long)(tvtp.tv_usec * 1000);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
S_error1("s_gettime", "unexpected typeno ~s", Sinteger(typeno));
|
S_error1("S_gettime", "unexpected typeno ~s", Sinteger(typeno));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -294,7 +294,7 @@ ptr S_clock_gettime(I32 typeno) {
|
||||||
struct timespec tp;
|
struct timespec tp;
|
||||||
time_t sec; I32 nsec;
|
time_t sec; I32 nsec;
|
||||||
|
|
||||||
s_gettime(typeno, &tp);
|
S_gettime(typeno, &tp);
|
||||||
|
|
||||||
sec = tp.tv_sec;
|
sec = tp.tv_sec;
|
||||||
nsec = tp.tv_nsec;
|
nsec = tp.tv_nsec;
|
||||||
|
@ -319,7 +319,7 @@ ptr S_gmtime(ptr tzoff, ptr tspair) {
|
||||||
if (tspair == Sfalse) {
|
if (tspair == Sfalse) {
|
||||||
struct timespec tp;
|
struct timespec tp;
|
||||||
|
|
||||||
s_gettime(time_utc, &tp);
|
S_gettime(time_utc, &tp);
|
||||||
tx = tp.tv_sec;
|
tx = tp.tv_sec;
|
||||||
INITVECTIT(dtvec, dtvec_nsec) = Sinteger(tp.tv_nsec);
|
INITVECTIT(dtvec, dtvec_nsec) = Sinteger(tp.tv_nsec);
|
||||||
} else {
|
} else {
|
||||||
|
@ -472,7 +472,7 @@ static long adjust_time_zone(ptr dtvec, struct tm *tmxp, ptr given_tzoff) {
|
||||||
ptr S_cputime(void) {
|
ptr S_cputime(void) {
|
||||||
struct timespec tp;
|
struct timespec tp;
|
||||||
|
|
||||||
s_gettime(time_process, &tp);
|
S_gettime(time_process, &tp);
|
||||||
return S_add(S_mul(S_integer_time_t(tp.tv_sec), FIX(1000)),
|
return S_add(S_mul(S_integer_time_t(tp.tv_sec), FIX(1000)),
|
||||||
Sinteger((tp.tv_nsec + 500000) / 1000000));
|
Sinteger((tp.tv_nsec + 500000) / 1000000));
|
||||||
}
|
}
|
||||||
|
@ -481,7 +481,7 @@ ptr S_realtime(void) {
|
||||||
struct timespec tp;
|
struct timespec tp;
|
||||||
time_t sec; I32 nsec;
|
time_t sec; I32 nsec;
|
||||||
|
|
||||||
s_gettime(time_monotonic, &tp);
|
S_gettime(time_monotonic, &tp);
|
||||||
|
|
||||||
sec = tp.tv_sec - starting_mono_tp.tv_sec;
|
sec = tp.tv_sec - starting_mono_tp.tv_sec;
|
||||||
nsec = tp.tv_nsec - starting_mono_tp.tv_nsec;
|
nsec = tp.tv_nsec - starting_mono_tp.tv_nsec;
|
||||||
|
@ -507,5 +507,5 @@ void S_stats_init() {
|
||||||
FreeLibrary(h);
|
FreeLibrary(h);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
s_gettime(time_monotonic, &starting_mono_tp);
|
S_gettime(time_monotonic, &starting_mono_tp);
|
||||||
}
|
}
|
||||||
|
|
|
@ -337,7 +337,7 @@ void S_condition_free(c) s_thread_cond_t *c; {
|
||||||
static inline int s_thread_cond_timedwait(s_thread_cond_t *cond, s_thread_mutex_t *mutex, int typeno, long sec, long nsec) {
|
static inline int s_thread_cond_timedwait(s_thread_cond_t *cond, s_thread_mutex_t *mutex, int typeno, long sec, long nsec) {
|
||||||
if (typeno == time_utc) {
|
if (typeno == time_utc) {
|
||||||
struct timespec now;
|
struct timespec now;
|
||||||
s_gettime(time_utc, &now);
|
S_gettime(time_utc, &now);
|
||||||
sec -= (long)now.tv_sec;
|
sec -= (long)now.tv_sec;
|
||||||
nsec -= now.tv_nsec;
|
nsec -= now.tv_nsec;
|
||||||
if (nsec < 0) {
|
if (nsec < 0) {
|
||||||
|
@ -364,7 +364,7 @@ static inline int s_thread_cond_timedwait(s_thread_cond_t *cond, s_thread_mutex_
|
||||||
struct timespec t;
|
struct timespec t;
|
||||||
if (typeno == time_duration) {
|
if (typeno == time_duration) {
|
||||||
struct timespec now;
|
struct timespec now;
|
||||||
s_gettime(time_utc, &now);
|
S_gettime(time_utc, &now);
|
||||||
t.tv_sec = now.tv_sec + sec;
|
t.tv_sec = now.tv_sec + sec;
|
||||||
t.tv_nsec = now.tv_nsec + nsec;
|
t.tv_nsec = now.tv_nsec + nsec;
|
||||||
if (t.tv_nsec >= 1000000000) {
|
if (t.tv_nsec >= 1000000000) {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user