diff options
author | Thorsten Lockert <tholo@cvs.openbsd.org> | 2004-06-24 19:35:28 +0000 |
---|---|---|
committer | Thorsten Lockert <tholo@cvs.openbsd.org> | 2004-06-24 19:35:28 +0000 |
commit | c6cc17e855e1d9fe177fba41d00de6e89fdc852e (patch) | |
tree | bdc6bde04c820ca59fe49d60185cf6ac40b44e30 /sys/netiso | |
parent | 128dd71ffeec48b94e085c757b3626553d619e7c (diff) |
This moves access to wall and uptime variables in MI code,
encapsulating all such access into wall-defined functions
that makes sure locking is done as needed.
It also cleans up some uses of wall time vs. uptime some
places, but there is sure to be more of these needed as
well, particularily in MD code. Also, many current calls
to microtime() should probably be changed to getmicrotime(),
or to the {,get}microuptime() versions.
ok art@ deraadt@ aaron@ matthieu@ beck@ sturm@ millert@ others
"Oh, that is not your problem!" from miod@
Diffstat (limited to 'sys/netiso')
-rw-r--r-- | sys/netiso/tp_meas.c | 7 | ||||
-rw-r--r-- | sys/netiso/tp_param.h | 10 | ||||
-rw-r--r-- | sys/netiso/tp_trace.c | 4 |
3 files changed, 10 insertions, 11 deletions
diff --git a/sys/netiso/tp_meas.c b/sys/netiso/tp_meas.c index 456386cd9c5..2089ffa38a5 100644 --- a/sys/netiso/tp_meas.c +++ b/sys/netiso/tp_meas.c @@ -1,4 +1,4 @@ -/* $OpenBSD: tp_meas.c,v 1.4 2003/12/10 07:22:44 itojun Exp $ */ +/* $OpenBSD: tp_meas.c,v 1.5 2004/06/24 19:35:26 tholo Exp $ */ /* $NetBSD: tp_meas.c,v 1.7 1996/02/13 22:11:18 christos Exp $ */ /*- @@ -69,8 +69,6 @@ SOFTWARE. #include <netiso/argo_debug.h> #include <netiso/tp_meas.h> -extern struct timeval time; - #ifdef TP_PERF_MEAS int tp_Measn = 0; struct tp_Meas tp_Meas[TPMEASN]; @@ -113,8 +111,7 @@ Tpmeas(ref, kind, timev, seq, win, size) if (kind == TPtime_from_ll) bcopy((caddr_t) timev, (caddr_t) & tpm->tpm_time, sizeof(struct timeval)); else - bcopy((caddr_t) & time, - (caddr_t) & tpm->tpm_time, sizeof(struct timeval)); + getmicrotime(&tpm->tpm_time); tpm->tpm_seq = seq; tpm->tpm_window = win; tpm->tpm_size = size; diff --git a/sys/netiso/tp_param.h b/sys/netiso/tp_param.h index 6c2af1324d6..7cdfbbb357c 100644 --- a/sys/netiso/tp_param.h +++ b/sys/netiso/tp_param.h @@ -1,4 +1,4 @@ -/* $OpenBSD: tp_param.h,v 1.4 2003/12/10 07:22:44 itojun Exp $ */ +/* $OpenBSD: tp_param.h,v 1.5 2004/06/24 19:35:26 tholo Exp $ */ /* $NetBSD: tp_param.h,v 1.9 1996/02/13 22:11:32 christos Exp $ */ /*- @@ -256,11 +256,13 @@ typedef unsigned short RefNum; * Some macros used all over, for timestamping *****************************************************/ -#define GET_CUR_TIME(tvalp) ((*tvalp) = time) +#define GET_CUR_TIME(tvalp) getmicrotime(tvalp) #define GET_TIME_SINCE(oldtvalp, diffp) {\ - (diffp)->tv_sec = time.tv_sec - (oldtvalp)->tv_sec;\ - (diffp)->tv_usec = time.tv_usec - (oldtvalp)->tv_usec;\ + struct timeval _tv;\ + getmicrotime(&_tv);\ + (diffp)->tv_sec = _tv.tv_sec - (oldtvalp)->tv_sec;\ + (diffp)->tv_usec = _tv.tv_usec - (oldtvalp)->tv_usec;\ if( (diffp)->tv_usec <0 ) {\ (diffp)->tv_sec --;\ (diffp)->tv_usec = 1000000 - (diffp)->tv_usec;\ diff --git a/sys/netiso/tp_trace.c b/sys/netiso/tp_trace.c index f6b9ee3bbf0..e7c87552f37 100644 --- a/sys/netiso/tp_trace.c +++ b/sys/netiso/tp_trace.c @@ -1,4 +1,4 @@ -/* $OpenBSD: tp_trace.c,v 1.4 2003/12/10 07:22:44 itojun Exp $ */ +/* $OpenBSD: tp_trace.c,v 1.5 2004/06/24 19:35:26 tholo Exp $ */ /* $NetBSD: tp_trace.c,v 1.6 1996/02/13 22:12:20 christos Exp $ */ /*- @@ -115,7 +115,7 @@ tpTrace(tpcb, event, arg, src, len, arg4, arg5) tp->tpt_arg = arg; if (tpcb) tp->tpt_arg2 = tpcb->tp_lref; - bcopy((caddr_t) & time, (caddr_t) & tp->tpt_time, sizeof(struct timeval)); + getmicrotime(&tp->tpt_time); switch (event) { |