diff options
author | Stephan Diestelhorst <stephan.diestelhorst@arm.com> | 2014-06-16 14:59:44 +0100 |
---|---|---|
committer | Stephan Diestelhorst <stephan.diestelhorst@arm.com> | 2014-06-16 14:59:44 +0100 |
commit | 4422d1322a8ed47bc9d743894ad47d82f33eba7c (patch) | |
tree | 54aa0efe2365af7d41d41e78cba3dae9434f13ee /src/sim/dvfs_handler.cc | |
parent | bf238470726b4cc5c0b34fcb349d767726fe53bc (diff) | |
download | gem5-4422d1322a8ed47bc9d743894ad47d82f33eba7c.tar.xz |
energy: Small extentions and fixes for DVFS handler
These additions allow easier interoperability with and querying from an
additional controller which will be in a separate patch. Also adding warnings
for changing the enabled state of the handler across checkpoint / resume and
deviating from the state in the configuration.
Contributed-by: Akash Bagdia <akash.bagdia@arm.com>
Diffstat (limited to 'src/sim/dvfs_handler.cc')
-rw-r--r-- | src/sim/dvfs_handler.cc | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/src/sim/dvfs_handler.cc b/src/sim/dvfs_handler.cc index bb60b1850..f4fe760a2 100644 --- a/src/sim/dvfs_handler.cc +++ b/src/sim/dvfs_handler.cc @@ -81,12 +81,26 @@ DVFSHandler::DVFSHandler(const Params *p) // Create a dedicated event slot per known domain ID UpdateEvent *event = &updatePerfLevelEvents[domain_id]; event->domainIDToSet = d->domainID(); + + // Add domain ID to the list of domains + domainIDList.push_back(d->domainID()); } UpdateEvent::dvfsHandler = this; } DVFSHandler *DVFSHandler::UpdateEvent::dvfsHandler; +DVFSHandler::DomainID +DVFSHandler::domainID(uint32_t index) const +{ + fatal_if(index >= numDomains(), "DVFS: Requested index out of "\ + "bound, max value %d\n", (domainIDList.size() - 1)); + + assert(domains.find(domainIDList[index]) != domains.end()); + + return domainIDList[index]; +} + bool DVFSHandler::validDomainID(DomainID domain_id) const { @@ -186,8 +200,15 @@ DVFSHandler::serialize(std::ostream &os) void DVFSHandler::unserialize(Checkpoint *cp, const std::string §ion) { + bool temp = enableHandler; + UNSERIALIZE_SCALAR(enableHandler); + if(temp != enableHandler) { + warn("DVFS: Forcing enable handler status to unserialized value of %d", + enableHandler); + } + // Reconstruct the map of domain IDs and their scheduled events std::vector<DomainID> domain_ids; std::vector<PerfLevel> perf_levels; |