sim_object.cc (7492:acc1fbbef239) sim_object.cc (7527:fe90827a663f)
1/*
2 * Copyright (c) 2001-2005 The Regents of The University of Michigan
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are
7 * met: redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer;

--- 83 unchanged lines hidden (view full) ---

92}
93
94void
95SimObject::resetStats()
96{
97}
98
99//
1/*
2 * Copyright (c) 2001-2005 The Regents of The University of Michigan
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are
7 * met: redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer;

--- 83 unchanged lines hidden (view full) ---

92}
93
94void
95SimObject::resetStats()
96{
97}
98
99//
100// static function:
101// call regStats() on all SimObjects and then regFormulas() on all
102// SimObjects.
103//
104struct SimObjectResetCB : public Callback
105{
106 virtual void process() { SimObject::resetAllStats(); }
107};
108
109namespace {
110 static SimObjectResetCB StatResetCB;
111}
112
113void
114SimObject::regAllStats()
115{
116 SimObjectList::iterator i;
117 SimObjectList::iterator end = simObjectList.end();
118
119 /**
120 * @todo change cprintfs to DPRINTFs
121 */
122 for (i = simObjectList.begin(); i != end; ++i) {
123#ifdef STAT_DEBUG
124 cprintf("registering stats for %s\n", (*i)->name());
125#endif
126 (*i)->regStats();
127 }
128
129 for (i = simObjectList.begin(); i != end; ++i) {
130#ifdef STAT_DEBUG
131 cprintf("registering formulas for %s\n", (*i)->name());
132#endif
133 (*i)->regFormulas();
134 }
135
136 Stats::registerResetCallback(&StatResetCB);
137}
138
139//
140// static function: call init() on all SimObjects.
141//
142void
143SimObject::initAll()
144{
145 SimObjectList::iterator i = simObjectList.begin();
146 SimObjectList::iterator end = simObjectList.end();
147
148 for (; i != end; ++i) {
149 SimObject *obj = *i;
150 obj->init();
151 }
152}
153
154//
155// static function: call resetStats() on all SimObjects.
156//
157void
158SimObject::resetAllStats()
159{
160 SimObjectList::iterator i = simObjectList.begin();
161 SimObjectList::iterator end = simObjectList.end();
162
163 for (; i != end; ++i) {
164 SimObject *obj = *i;
165 obj->resetStats();
166 }
167}
168
169//
170// static function: serialize all SimObjects.
171//
172void
173SimObject::serializeAll(ostream &os)
174{
175 SimObjectList::reverse_iterator ri = simObjectList.rbegin();
176 SimObjectList::reverse_iterator rend = simObjectList.rend();
177

--- 18 unchanged lines hidden (view full) ---

196 obj->unserialize(cp, obj->name());
197 else
198 warn("Not unserializing '%s': no section found in checkpoint.\n",
199 obj->name());
200 }
201}
202
203
100// static function: serialize all SimObjects.
101//
102void
103SimObject::serializeAll(ostream &os)
104{
105 SimObjectList::reverse_iterator ri = simObjectList.rbegin();
106 SimObjectList::reverse_iterator rend = simObjectList.rend();
107

--- 18 unchanged lines hidden (view full) ---

126 obj->unserialize(cp, obj->name());
127 else
128 warn("Not unserializing '%s': no section found in checkpoint.\n",
129 obj->name());
130 }
131}
132
133
204void
205SimObject::startupAll()
206{
207 SimObjectList::iterator i = simObjectList.begin();
208 SimObjectList::iterator end = simObjectList.end();
209
134
210 while (i != end) {
211 (*i)->startup();
212 ++i;
213 }
214}
215
216
217#ifdef DEBUG
218//
219// static function: flag which objects should have the debugger break
220//
221void
222SimObject::debugObjectBreak(const string &objs)
223{
224 SimObjectList::const_iterator i = simObjectList.begin();

--- 62 unchanged lines hidden ---
135#ifdef DEBUG
136//
137// static function: flag which objects should have the debugger break
138//
139void
140SimObject::debugObjectBreak(const string &objs)
141{
142 SimObjectList::const_iterator i = simObjectList.begin();

--- 62 unchanged lines hidden ---