1# Copyright (c) 2005 The Regents of The University of Michigan 2# All rights reserved. 3# 4# Redistribution and use in source and binary forms, with or without 5# modification, are permitted provided that the following conditions are 6# met: redistributions of source code must retain the above copyright 7# notice, this list of conditions and the following disclaimer; 8# redistributions in binary form must reproduce the above copyright --- 32 unchanged lines hidden (view full) --- 41import objects 42from util import fatal 43 44# define a MaxTick parameter 45MaxTick = 2**63 - 1 46 47# The final hook to generate .ini files. Called from the user script 48# once the config is built. |
49def instantiate(ckpt_dir=None): |
50 root = objects.Root.getInstance() 51 52 if not root: 53 fatal("Need to instantiate Root() before calling instantiate()") 54 55 # we need to fix the global frequency 56 ticks.fixGlobalFrequency() 57 --- 23 unchanged lines hidden (view full) --- 81 82 # Do a third pass to initialize statistics 83 for obj in root.descendants(): obj.regStats() 84 for obj in root.descendants(): obj.regFormulas() 85 86 # We're done registering statistics. Enable the stats package now. 87 stats.enable() 88 |
89 # Restore checkpoint (if any) 90 if ckpt_dir: 91 internal.core.unserializeAll(ckpt_dir) 92 need_resume.append(root) 93 |
94 # Reset to put the stats in a consistent state. 95 stats.reset() 96 97def doDot(root): 98 dot = pydot.Dot() 99 instance.outputDot(dot) 100 dot.orientation = "portrait" 101 dot.size = "8.5,11" --- 58 unchanged lines hidden (view full) --- 160 root = objects.Root.getInstance() 161 if not isinstance(root, objects.Root): 162 raise TypeError, "Checkpoint must be called on a root object." 163 doDrain(root) 164 print "Writing checkpoint" 165 internal.core.serializeAll(dir) 166 resume(root) 167 |
168def changeToAtomic(system): 169 if not isinstance(system, (objects.Root, objects.System)): 170 raise TypeError, "Parameter of type '%s'. Must be type %s or %s." % \ 171 (type(system), objects.Root, objects.System) 172 if system.getMemoryMode() != objects.params.atomic: 173 doDrain(system) 174 print "Changing memory mode to atomic" 175 for obj in system.descendants(): --- 35 unchanged lines hidden --- |