X-Git-Url: https://git.libre-soc.org/?a=blobdiff_plain;f=src%2Fpython%2Fm5%2Fticks.py;h=ce9459f2a98cea00d13bd3b2bce1c236960b4bb5;hb=1ccc7025398a78e0483ec5a9706a8de019d83474;hp=e91b470ff626d1d46da1309a46973fffba723a76;hpb=46051c5f651c8a95dde7bb7eb80e86a48749af45;p=gem5.git diff --git a/src/python/m5/ticks.py b/src/python/m5/ticks.py index e91b470ff..ce9459f2a 100644 --- a/src/python/m5/ticks.py +++ b/src/python/m5/ticks.py @@ -27,22 +27,23 @@ # Authors: Nathan Binkert import sys - -import convert -import internal +from m5.util import warn tps = 1.0e12 # default to 1 THz (1 Tick == 1 ps) tps_fixed = False # once set to true, can't be changed # fix the global frequency and tell C++ about it def fixGlobalFrequency(): + import _m5.core global tps, tps_fixed if not tps_fixed: tps_fixed = True - internal.core.setClockFrequency(int(tps)) + _m5.core.setClockFrequency(int(tps)) print "Global frequency set at %d ticks per second" % int(tps) def setGlobalFrequency(ticksPerSecond): + from m5.util import convert + global tps, tps_fixed if tps_fixed: @@ -81,8 +82,8 @@ def fromSeconds(value): int_value = int(round(value)) err = (value - int_value) / value if err > frequency_tolerance: - print >>sys.stderr, "Warning: rounding error > tolerance" - print >>sys.stderr, " %f rounded to %d" % (value, int_value) + warn("rounding error > tolerance\n %f rounded to %d", value, + int_value) return int_value __all__ = [ 'setGlobalFrequency', 'fixGlobalFrequency', 'fromSeconds',