config: Add a --without-python option to build process
[gem5.git] / src / sim / dvfs_handler.cc
index bb60b18504da21db02087787e02f6093fc838800..f4fe760a2d7944c0c21b9eee1d11632ac47f1070 100644 (file)
@@ -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 &section)
 {
+    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;