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(CheckpointOut &cp) const
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 (const auto &ev_pair : updatePerfLevelEvents) {
186 DomainID id = ev_pair.first;
187 const UpdateEvent *event = &ev_pair.second;
188
189 assert(id == event->domainIDToSet);
190 domain_ids.push_back(id);
191 perf_levels.push_back(event->perfLevelToSet);
192 whens.push_back(event->scheduled() ? event->when() : 0);
193 }
194 SERIALIZE_CONTAINER(domain_ids);
195 SERIALIZE_CONTAINER(perf_levels);
196 SERIALIZE_CONTAINER(whens);
197}
198
199void
200DVFSHandler::unserialize(CheckpointIn &cp)
201{
202 bool temp = enableHandler;
203
204 UNSERIALIZE_SCALAR(enableHandler);
205
206 if(temp != enableHandler) {
207 warn("DVFS: Forcing enable handler status to unserialized value of %d",
208 enableHandler);
209 }
210
211 // Reconstruct the map of domain IDs and their scheduled events
212 std::vector<DomainID> domain_ids;
213 std::vector<PerfLevel> perf_levels;
214 std::vector<Tick> whens;
215 UNSERIALIZE_CONTAINER(domain_ids);
216 UNSERIALIZE_CONTAINER(perf_levels);
217 UNSERIALIZE_CONTAINER(whens);
218
219 for (size_t i = 0; i < domain_ids.size(); ++i) {;
220 UpdateEvent *event = &updatePerfLevelEvents[domain_ids[i]];
221
222 event->domainIDToSet = domain_ids[i];
223 event->perfLevelToSet = perf_levels[i];
224
225 // Schedule all previously scheduled events
226 if (whens[i])
227 schedule(event, whens[i]);
228 }
229 UpdateEvent::dvfsHandler = this;
230}
231
232DVFSHandler*
233DVFSHandlerParams::create()
234{
235 return new DVFSHandler(this);
236}