retroforth/vm/nga-python/BenchmarkDevice.py
crc b1dce01d9d nga-python: add stubs for benchmark device (#28); add support for running under Python2 (for use w/pypy)
FossilOrigin-Name: 2b8e1c48bdb444f0b08f9813fa09493455f801e058146e75a27acb35a2907393
2021-02-03 12:54:42 +00:00

23 lines
412 B
Python

# Benchmark Support
#
# This is intended to help support benchmarking by
# providing high resolution timing and instruction
# usage data.
#
import time
class BenchmarkDevice:
def __init__(self):
pass
def execute(self, retro_instance, pointer):
return 0
def timer_resolution(self):
try:
time.time_ns()
return 1
except:
return 0