dvfs_handler.cc (10395:77b9f96786c1) | dvfs_handler.cc (10905:a6ca6831e775) |
---|---|
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 | 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) | 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; | 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; | 185 for (const auto &ev_pair : updatePerfLevelEvents) { 186 DomainID id = ev_pair.first; 187 const UpdateEvent *event = &ev_pair.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 } | 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 } |
195 arrayParamOut(os, "domain_ids", domain_ids); 196 arrayParamOut(os, "perf_levels", perf_levels); 197 arrayParamOut(os, "whens", whens); | 194 SERIALIZE_CONTAINER(domain_ids); 195 SERIALIZE_CONTAINER(perf_levels); 196 SERIALIZE_CONTAINER(whens); |
198} 199 200void | 197} 198 199void |
201DVFSHandler::unserialize(Checkpoint *cp, const std::string §ion) | 200DVFSHandler::unserialize(CheckpointIn &cp) |
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; | 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; |
216 arrayParamIn(cp, section, "domain_ids", domain_ids); 217 arrayParamIn(cp, section, "perf_levels", perf_levels); 218 arrayParamIn(cp, section, "whens", whens); | 215 UNSERIALIZE_CONTAINER(domain_ids); 216 UNSERIALIZE_CONTAINER(perf_levels); 217 UNSERIALIZE_CONTAINER(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} | 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} |