Subject: kern/kern_microtime.c nit
To: None <tech-kern@netbsd.org>
From: Simon Burge <simonb@wasabisystems.com>
List: tech-kern
Date: 05/31/2003 12:45:43
Talking of microtime, anyone see anything wrong with the following
patch? We always read from the global "time" variable, even if we
go on to use the value in curcpu()->ci_cc_time.
Simon.
--
Simon Burge <simonb@wasabisystems.com>
NetBSD Development, Support and Service: http://www.wasabisystems.com/
Index: kern/kern_microtime.c
===================================================================
RCS file: /cvsroot/src/sys/kern/kern_microtime.c,v
retrieving revision 1.2
diff -d -p -u -r1.2 kern_microtime.c
--- kern/kern_microtime.c 2003/05/17 01:50:56 1.2
+++ kern/kern_microtime.c 2003/05/31 02:38:28
@@ -79,7 +79,7 @@ cc_microtime(struct timeval *tvp)
{
static struct timeval lasttime;
static struct simplelock microtime_slock = SIMPLELOCK_INITIALIZER;
- struct timeval t, st;
+ struct timeval t;
struct cpu_info *ci = curcpu();
int64_t sec, usec;
int s;
@@ -90,9 +90,6 @@ cc_microtime(struct timeval *tvp)
s = splclock(); /* block clock interrupts */
#endif
- /* XXXSMP: not atomic */
- st = time; /* read system time */
-
if (ci->ci_cc_denom != 0) {
/*
* Determine the current clock time as the time at last
@@ -118,7 +115,8 @@ cc_microtime(struct timeval *tvp)
/*
* Can't use the CC -- just use the system time.
*/
- t = st;
+ /* XXXSMP: not atomic */
+ t = time;
}
/*