diff options
author | Sascha Bischoff <sascha.bischoff@arm.com> | 2013-02-15 17:40:10 -0500 |
---|---|---|
committer | Sascha Bischoff <sascha.bischoff@arm.com> | 2013-02-15 17:40:10 -0500 |
commit | 2f3b322280a742069fd8965d723a2205a4a8cc00 (patch) | |
tree | 8c40a9c9397e5ffdb2a3382fd2b4766b6ac13977 /src/python/m5/ticks.py | |
parent | e88e7d88b9a9876ee040dad96acf3deabebe1fa7 (diff) | |
download | gem5-2f3b322280a742069fd8965d723a2205a4a8cc00.tar.xz |
base: Add warn() and inform() to m5.utils for use from python
This patch adds two fuctions to m5.util, warn and inform, which mirror those
found in the C++ side of gem5. These are added in addition to the already
existing m5.util.panic and m5.util.fatal which already mirror the C++
functionality. This ensures that warning and information messages generated
by python are in the same format as those generated by C++.
Occurrences of
print "Warning: %s..." % name
have been replaced with
warn("%s...", name)
Diffstat (limited to 'src/python/m5/ticks.py')
-rw-r--r-- | src/python/m5/ticks.py | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/python/m5/ticks.py b/src/python/m5/ticks.py index 181a65eba..0d82f6edd 100644 --- a/src/python/m5/ticks.py +++ b/src/python/m5/ticks.py @@ -27,6 +27,7 @@ # Authors: Nathan Binkert import sys +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 @@ -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', |