From 93b475981e7326f53dee0369476344f8552f4e7b Mon Sep 17 00:00:00 2001 From: Sigrid Date: Fri, 7 Aug 2020 17:08:49 +0200 Subject: vmx: set xstart to either nsec or cycles depending on what is available --- sys/src/cmd/vmx/nanosec.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/sys/src/cmd/vmx/nanosec.c b/sys/src/cmd/vmx/nanosec.c index ee5fc9108..ac418483d 100644 --- a/sys/src/cmd/vmx/nanosec.c +++ b/sys/src/cmd/vmx/nanosec.c @@ -6,9 +6,6 @@ * nsec() is wallclock and can be adjusted by timesync * so need to use cycles() instead, but fall back to * nsec() in case we can't - * - * "fasthz" is how many ticks there are in a second - * can be read from /dev/time */ uvlong nanosec(void) @@ -20,12 +17,14 @@ nanosec(void) return nsec() - xstart; if(fasthz == 0){ - xstart = nsec(); if((fasthz = _tos->cyclefreq) == 0){ fasthz = ~0ULL; + xstart = nsec(); fprint(2, "cyclefreq not available, falling back to nsec()\n"); fprint(2, "you might want to disable aux/timesync\n"); return 0; + }else{ + cycles(&xstart); } } cycles(&x); -- cgit v1.2.3