kernel-mode #1
@ -142,11 +142,11 @@ class PrivCPU(CPU):
|
|||||||
|
|
||||||
@self.csr.virtual_register('time')
|
@self.csr.virtual_register('time')
|
||||||
def get_time():
|
def get_time():
|
||||||
return (time.perf_counter_ns() // self.TIME_RESOLUTION_NS) & (2 ** 32 - 1)
|
return (time.perf_counter_ns() // self.TIME_RESOLUTION_NS - self._time_start) & (2 ** 32 - 1)
|
||||||
|
|
||||||
@self.csr.virtual_register('timeh')
|
@self.csr.virtual_register('timeh')
|
||||||
def get_timeh():
|
def get_timeh():
|
||||||
return (time.perf_counter_ns() // self.TIME_RESOLUTION_NS) >> 32
|
return (time.perf_counter_ns() // self.TIME_RESOLUTION_NS - self._time_start) >> 32
|
||||||
|
|
||||||
# add minstret and mcycle counters
|
# add minstret and mcycle counters
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user