if 'cxx_header' not in cls._value_dict:
global noCxxHeader
noCxxHeader = True
- print >> sys.stderr, \
- "warning: No header file specified for SimObject: %s" % name
+ warn("No header file specified for SimObject: %s", name)
# Export methods are automatically inherited via C++, so we
# don't want the method declarations to get inherited on the
def add_child(self, name, child):
child = coerceSimObjectOrVector(child)
if child.has_parent():
- print "warning: add_child('%s'): child '%s' already has parent" % \
- (name, child.get_name())
+ warn("add_child('%s'): child '%s' already has parent", name,
+ child.get_name())
if self._children.has_key(name):
# This code path had an undiscovered bug that would make it fail
# at runtime. It had been here for a long time and was only
val = SimObjectVector(val)
self._values[key] = val
if isSimObjectOrVector(val) and not val.has_parent():
- print "warning: %s adopting orphan SimObject param '%s'" \
- % (self, key)
+ warn("%s adopting orphan SimObject param '%s'", self, key)
self.add_child(key, val)
def path(self):
# 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
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',
print >>sys.stderr, 'fatal:', fmt % args
sys.exit(1)
+# warn() should be called when the user should be warned about some condition
+# that may or may not be the user's fault, but that they should be made aware
+# of as it may affect the simulation or results.
+def warn(fmt, *args):
+ print >>sys.stderr, 'warn:', fmt % args
+
+# inform() should be called when the user should be informed about some
+# condition that they may be interested in.
+def inform(fmt, *args):
+ print >>sys.stdout, 'info:', fmt % args
+
class Singleton(type):
def __call__(cls, *args, **kwargs):
if hasattr(cls, '_instance'):
import m5, os, re
from m5.SimObject import isRoot, isSimObjectVector
+from m5.util import warn
try:
import pydot
except:
# So avoid terminating simulation unnecessarily
callgraph.write_pdf(dot_filename + ".pdf")
except:
- print "warning: failed to generate pdf output from %s" % dot_filename
+ warn("failed to generate pdf output from %s", dot_filename)