diff options
author | Sigrid <ftrvxmtrx@gmail.com> | 2020-08-07 17:08:49 +0200 |
---|---|---|
committer | Sigrid <ftrvxmtrx@gmail.com> | 2020-08-07 17:08:49 +0200 |
commit | 93b475981e7326f53dee0369476344f8552f4e7b (patch) | |
tree | 1ddbf7cea37e9aede7ed73a1d48725ef4ffe4c1a /sys/src/cmd/vmx | |
parent | 711b69c0473d5dc962c7938c1cbbbf6c74cfba4d (diff) |
vmx: set xstart to either nsec or cycles depending on what is available
Diffstat (limited to 'sys/src/cmd/vmx')
-rw-r--r-- | sys/src/cmd/vmx/nanosec.c | 7 |
1 files 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); |