config: support outputing a pickle of the configuration tree

This commit is contained in:
Ali Saidi
2012-01-09 18:08:20 -06:00
parent c94e5256d9
commit 68d387ec80
4 changed files with 55 additions and 10 deletions

View File

@@ -31,6 +31,7 @@
import atexit
import os
import sys
import json
# import the SWIG-wrapped main C++ functions
import internal
@@ -40,6 +41,7 @@ import SimObject
import ticks
import objects
from util import fatal
from util import attrdict
# define a MaxTick parameter
MaxTick = 2**63 - 1
@@ -71,6 +73,13 @@ def instantiate(ckpt_dir=None):
obj.print_ini(ini_file)
ini_file.close()
if options.json_config:
json_file = file(os.path.join(options.outdir, options.json_config), 'w')
d = root.get_config_as_dict()
json.dump(d, json_file, indent=4)
json_file.close()
# Initialize the global statistics
stats.initSimStats()