configs: add command-line option to stop debug output

This patch adds a --debug-end flag to main.py so that debug output can be
stoped at a specified tick, while allowing the simulation to continue. It is
useful in situations where you would like to produce a trace for a region of
interest while still collecting stats for the entire run. This is in contrast
to the currently existing --debug-break flag, which terminates the simulation
at the tick.
This commit is contained in:
Michael LeBeane 2016-02-13 12:36:43 -05:00
parent 8d923c7380
commit 2ae4cce393

View file

@ -103,6 +103,8 @@ def parse_options():
help="Sets the flags for debug output (-FLAG disables a flag)") help="Sets the flags for debug output (-FLAG disables a flag)")
option("--debug-start", metavar="TICK", type='int', option("--debug-start", metavar="TICK", type='int',
help="Start debug output at TICK") help="Start debug output at TICK")
option("--debug-end", metavar="TICK", type='int',
help="End debug output at TICK")
option("--debug-file", metavar="FILE", default="cout", option("--debug-file", metavar="FILE", default="cout",
help="Sets the output file for debug [Default: %default]") help="Sets the output file for debug [Default: %default]")
option("--debug-ignore", metavar="EXPR", action='append', split=':', option("--debug-ignore", metavar="EXPR", action='append', split=':',
@ -348,6 +350,11 @@ def main(*args):
else: else:
trace.enable() trace.enable()
if options.debug_end:
check_tracing()
e = event.create(trace.disable, event.Event.Debug_Enable_Pri)
event.mainq.schedule(e, options.debug_end)
trace.output(options.debug_file) trace.output(options.debug_file)
for ignore in options.debug_ignore: for ignore in options.debug_ignore: