def main():
    from _m5.stattest import stattest_init, stattest_run
    import m5.stats

    stattest_init()

    # Initialize the global statistics
    m5.stats.initSimStats()
    m5.stats.initText("cout")

    # We're done registering statistics.  Enable the stats package now.
    m5.stats.enable()

    # Reset to put the stats in a consistent state.
    m5.stats.reset()

    stattest_run()

    m5.stats.dump()

def main():
    from _m5.stattest import stattest_init, stattest_run
    import m5.stats

    stattest_init()

    # Initialize the global statistics
    m5.stats.initSimStats()
    m5.stats.addStatVisitor("cout")

    # We're done registering statistics.  Enable the stats package now.
    m5.stats.enable()

    # Reset to put the stats in a consistent state.
    m5.stats.reset()

    stattest_run()

    m5.stats.dump()

Fix the stats unit test.
tests: Fix the stats unit test.

This has been broken since February. The interface for opening
initializing where the stats output should go was changed, but the
test wasn't updated.

Change-Id: I54bd8be15bf870352d5fcfad95ded28d87c7cc5a
Reviewed-on: https://gem5-review.googlesource.com/6001
Reviewed-by: Andreas Sandberg <c9f5686ee5bd561c93f9de79681eee75bfa7f36e@arm.com>
Maintainer: Andreas Sandberg <c9f5686ee5bd561c93f9de79681eee75bfa7f36e@arm.com>

  def main():
      from _m5.stattest import stattest_init, stattest_run
      import m5.stats
  
      stattest_init()
  
      # Initialize the global statistics
      m5.stats.initSimStats()
-     m5.stats.initText("cout")
+     m5.stats.addStatVisitor("cout")
  
      # We're done registering statistics.  Enable the stats package now.
      m5.stats.enable()
  
      # Reset to put the stats in a consistent state.
      m5.stats.reset()
  
      stattest_run()
  
      m5.stats.dump()
  
Fix the stats unit test.
## Code Before:
def main():
    from _m5.stattest import stattest_init, stattest_run
    import m5.stats

    stattest_init()

    # Initialize the global statistics
    m5.stats.initSimStats()
    m5.stats.initText("cout")

    # We're done registering statistics.  Enable the stats package now.
    m5.stats.enable()

    # Reset to put the stats in a consistent state.
    m5.stats.reset()

    stattest_run()

    m5.stats.dump()

## Instruction:
Fix the stats unit test.
## Code After:
def main():
    from _m5.stattest import stattest_init, stattest_run
    import m5.stats

    stattest_init()

    # Initialize the global statistics
    m5.stats.initSimStats()
    m5.stats.addStatVisitor("cout")

    # We're done registering statistics.  Enable the stats package now.
    m5.stats.enable()

    # Reset to put the stats in a consistent state.
    m5.stats.reset()

    stattest_run()

    m5.stats.dump()
