Deleted Added
sdiff udiff text old ( 10395:77b9f96786c1 ) new ( 10905:a6ca6831e775 )
full compact
1/*
2 * Copyright (c) 2013-2014 ARM Limited
3 * All rights reserved
4 *
5 * The license below extends only to copyright in the software and shall
6 * not be construed as granting a license to any other intellectual
7 * property including but not limited to intellectual property relating
8 * to a hardware implementation of the functionality of the software

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

165 // Update the performance level in the clock domain
166 auto d = dvfsHandler->findDomain(domainIDToSet);
167 assert(d->perfLevel() != perfLevelToSet);
168
169 d->perfLevel(perfLevelToSet);
170}
171
172void
173DVFSHandler::serialize(std::ostream &os)
174{
175 //This is to ensure that the handler status is maintained during the
176 //entire simulation run and not changed from command line during checkpoint
177 //and restore
178 SERIALIZE_SCALAR(enableHandler);
179
180 // Pull out the hashed data structure into easy-to-serialise arrays;
181 // ensuring that the data associated with any pending update event is saved
182 std::vector<DomainID> domain_ids;
183 std::vector<PerfLevel> perf_levels;
184 std::vector<Tick> whens;
185 for (auto it = updatePerfLevelEvents.begin();
186 it != updatePerfLevelEvents.end(); ++it) {
187 DomainID id = it->first;
188 UpdateEvent *event = &it->second;
189
190 assert(id == event->domainIDToSet);
191 domain_ids.push_back(id);
192 perf_levels.push_back(event->perfLevelToSet);
193 whens.push_back(event->scheduled() ? event->when() : 0);
194 }
195 arrayParamOut(os, "domain_ids", domain_ids);
196 arrayParamOut(os, "perf_levels", perf_levels);
197 arrayParamOut(os, "whens", whens);
198}
199
200void
201DVFSHandler::unserialize(Checkpoint *cp, const std::string &section)
202{
203 bool temp = enableHandler;
204
205 UNSERIALIZE_SCALAR(enableHandler);
206
207 if(temp != enableHandler) {
208 warn("DVFS: Forcing enable handler status to unserialized value of %d",
209 enableHandler);
210 }
211
212 // Reconstruct the map of domain IDs and their scheduled events
213 std::vector<DomainID> domain_ids;
214 std::vector<PerfLevel> perf_levels;
215 std::vector<Tick> whens;
216 arrayParamIn(cp, section, "domain_ids", domain_ids);
217 arrayParamIn(cp, section, "perf_levels", perf_levels);
218 arrayParamIn(cp, section, "whens", whens);
219
220 for (size_t i = 0; i < domain_ids.size(); ++i) {;
221 UpdateEvent *event = &updatePerfLevelEvents[domain_ids[i]];
222
223 event->domainIDToSet = domain_ids[i];
224 event->perfLevelToSet = perf_levels[i];
225
226 // Schedule all previously scheduled events
227 if (whens[i])
228 schedule(event, whens[i]);
229 }
230 UpdateEvent::dvfsHandler = this;
231}
232
233DVFSHandler*
234DVFSHandlerParams::create()
235{
236 return new DVFSHandler(this);
237}