Properly adding trace setups to a simulation batch.
Get the number of trace players from the XML tree. At this point the configuration was not loaded yet.
This commit is contained in:
@@ -73,7 +73,7 @@ struct Configuration
|
||||
bool DatabaseRecording = true;
|
||||
bool PowerAnalysis = false;
|
||||
bool Debug = false;
|
||||
unsigned int NumberOfTracePlayers = 4;
|
||||
unsigned int NumberOfTracePlayers = 1;
|
||||
unsigned int NumberOfMemChannels = 1;
|
||||
|
||||
//MemSpec(from DRAM-Power XML)
|
||||
|
||||
@@ -32,16 +32,18 @@
|
||||
* Authors:
|
||||
* Janik Schlemminger
|
||||
* Matthias Jung
|
||||
* Eder F. Zulian
|
||||
*/
|
||||
|
||||
#include <sys/wait.h>
|
||||
#include <boost/filesystem.hpp>
|
||||
|
||||
#include "SimulationManager.h"
|
||||
#include "../common/Utils.h"
|
||||
|
||||
using namespace std;
|
||||
using namespace tinyxml2;
|
||||
|
||||
|
||||
SimulationManager::SimulationManager(string resources) : resources(resources)
|
||||
{
|
||||
}
|
||||
@@ -123,14 +125,7 @@ void SimulationManager::parseSimulationBatch(XMLElement* simulation)
|
||||
}
|
||||
}
|
||||
|
||||
XMLElement* tracesetups = simulation->FirstChildElement("tracesetups");
|
||||
if(tracesetups == NULL) tracesetups = simulation;
|
||||
|
||||
for (XMLElement* tracesetup = tracesetups->FirstChildElement("tracesetup"); tracesetup != NULL;
|
||||
tracesetup = tracesetup->NextSiblingElement("tracesetup"))
|
||||
{
|
||||
addTraceSetup(batch, tracesetup);
|
||||
}
|
||||
addTraceSetup(batch, simulation);
|
||||
|
||||
simulationBatches.push_back(batch);
|
||||
|
||||
@@ -159,17 +154,29 @@ void SimulationManager::startTraceAnalyzer()
|
||||
system(run_tpr.c_str());
|
||||
}
|
||||
|
||||
void SimulationManager::addTraceSetup(SimulationBatch& batch, tinyxml2::XMLElement* element)
|
||||
void SimulationManager::addTraceSetup(SimulationBatch &batch, tinyxml2::XMLElement *simulation)
|
||||
{
|
||||
vector<Device> devices;
|
||||
for (XMLElement* device = element->FirstChildElement("device"); device != NULL; device = device->NextSiblingElement("device")) {
|
||||
devices.push_back(Device(device->GetText(), device->IntAttribute("clkMhz"), device->IntAttribute("bl")));
|
||||
}
|
||||
while (devices.size() < Configuration::getInstance().NumberOfTracePlayers) {
|
||||
devices.push_back(Device());
|
||||
}
|
||||
XMLElement *tracesetups = simulation->FirstChildElement("tracesetups");
|
||||
XMLElement *simconfig = simulation->FirstChildElement("simconfig");
|
||||
XMLElement *ntp = simconfig->FirstChildElement("NumberOfTracePlayers");
|
||||
unsigned int numberOfTracePlayers;
|
||||
ntp->QueryUnsignedAttribute("value", &numberOfTracePlayers);
|
||||
|
||||
batch.traceSetups.emplace(element->Attribute("id"), devices);
|
||||
for (XMLElement *tracesetup = tracesetups->FirstChildElement("tracesetup"); tracesetup != NULL; tracesetup = tracesetup->NextSiblingElement("tracesetup")) {
|
||||
|
||||
// TODO: check device's "bl" argument.
|
||||
for (XMLElement *device = tracesetup->FirstChildElement("device"); device != NULL; device = device->NextSiblingElement("device")) {
|
||||
devices.push_back(Device(device->GetText(), device->IntAttribute("clkMhz"), device->IntAttribute("bl")));
|
||||
}
|
||||
|
||||
// This step is done here to add a default device in case the user haven't specified a trace file to be executed by one or more trace players.
|
||||
while (devices.size() < numberOfTracePlayers) {
|
||||
devices.push_back(Device());
|
||||
}
|
||||
|
||||
batch.traceSetups.emplace(tracesetup->Attribute("id"), devices);
|
||||
}
|
||||
}
|
||||
|
||||
void SimulationManager::report(string message)
|
||||
|
||||
Reference in New Issue
Block a user