Quick and Dirty XML - Refactoring necessary
This commit is contained in:
@@ -24,28 +24,27 @@ SimulationManager::~SimulationManager()
|
||||
|
||||
void SimulationManager::loadSimulationsFromXML(string uri)
|
||||
{
|
||||
cout << "\n\nLoad Simulation-Batchs:" << endl;
|
||||
cout << "\n\nload simulation-batch:" << endl;
|
||||
cout << headline << endl;
|
||||
cout << "\t-> load simulations .." << endl;
|
||||
|
||||
exportPath = getFileName(uri);
|
||||
XMLDocument doc;
|
||||
loadXML(uri, doc);
|
||||
|
||||
loadXML(uri, simulationdoc);
|
||||
|
||||
cout << "\t-> parsing simulation objects .." << endl;
|
||||
|
||||
for (XMLElement* element = doc.FirstChildElement("simulation"); element != NULL;
|
||||
element = element->NextSiblingElement("simulation"))
|
||||
{
|
||||
parseSimulationBatch(element);
|
||||
}
|
||||
XMLElement* simulation = simulationdoc.FirstChildElement("simulation");
|
||||
string xmlNodeName(simulation->Name());
|
||||
if( xmlNodeName != "simulation")
|
||||
reportFatal("SimulationManager", "simulation node expected");
|
||||
parseSimulationBatch(simulation);
|
||||
|
||||
cout << "\t-> checking paths .." << endl;
|
||||
checkPaths();
|
||||
//cout << "\t-> checking paths .." << endl;
|
||||
//checkPaths();
|
||||
|
||||
cout << "\t-> simulation batches loaded successfully!\n" << endl;
|
||||
|
||||
for (auto batch : simulationsBatches)
|
||||
for (auto batch : simulationBatches)
|
||||
{
|
||||
batch.print();
|
||||
}
|
||||
@@ -53,22 +52,22 @@ void SimulationManager::loadSimulationsFromXML(string uri)
|
||||
|
||||
void SimulationManager::runSimulations()
|
||||
{
|
||||
for (auto& batch : simulationsBatches)
|
||||
for (auto& batch : simulationBatches)
|
||||
{
|
||||
boost::filesystem::path dir(exportPath + "/" + batch.simulationName);
|
||||
boost::filesystem::path dir(exportPath);// + "/" + batch.simulationName);
|
||||
boost::filesystem::create_directories(dir);
|
||||
|
||||
for (auto& dramSetup : batch.dramSetups)
|
||||
{
|
||||
string memconfig = getFileName(dramSetup.memconfig);
|
||||
string memspec = getFileName(dramSetup.memspec);
|
||||
string addressmappig = getFileName(dramSetup.addressmapping);
|
||||
//string memconfig = getFileName(dramSetup.memconfig);
|
||||
//string memspec = getFileName(dramSetup.memspec);
|
||||
//string addressmappig = getFileName(dramSetup.addressmapping);
|
||||
|
||||
for (auto& traceSetup : batch.traceSetups)
|
||||
{
|
||||
runSimulation(
|
||||
exportPath + "/" + batch.simulationName + "/" + traceSetup.first + "-" + memspec + "-" +
|
||||
memconfig + ".tdb", dramSetup, traceSetup.second);
|
||||
// string exportname = exportPath + "/" + batch.simulationName + "/" + traceSetup.first + ".tdb";
|
||||
string exportname = exportPath + "/" + traceSetup.first + ".tdb";
|
||||
runSimulation(exportname, dramSetup, traceSetup.second);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -78,34 +77,52 @@ void SimulationManager::parseSimulationBatch(XMLElement* simulation)
|
||||
{
|
||||
SimulationBatch batch;
|
||||
|
||||
batch.simulationName = simulation->Attribute("id");
|
||||
//batch.simulationName = simulation->Attribute("id");
|
||||
|
||||
string memspecUri;
|
||||
string addressmappingUri;
|
||||
//string memspecUri;
|
||||
//string addressmappingUri;
|
||||
|
||||
for (XMLElement* element = simulation->FirstChildElement("memspec"); element != NULL;
|
||||
element = element->NextSiblingElement("memspec"))
|
||||
XMLElement* simconfig = simulation->FirstChildElement("simconfig");
|
||||
|
||||
XMLElement* memspecs = simulation->FirstChildElement("memspecs");
|
||||
if(memspecs == NULL) memspecs = simulation;
|
||||
|
||||
XMLElement* addressmappings = simulation->FirstChildElement("addressmappings");
|
||||
if(addressmappings == NULL) addressmappings = simulation;
|
||||
|
||||
XMLElement* memconfigs = simulation->FirstChildElement("memconfigs");
|
||||
if(memconfigs == NULL) memconfigs = simulation;
|
||||
|
||||
|
||||
|
||||
for (XMLElement* memspec = memspecs->FirstChildElement("memspec"); memspec != NULL;
|
||||
memspec = memspec->NextSiblingElement("memspec"))
|
||||
{
|
||||
memspecUri = element->GetText();
|
||||
for (XMLElement* element = simulation->FirstChildElement("addressmapping"); element != NULL;
|
||||
element = element->NextSiblingElement("addressmapping"))
|
||||
//memspecUri = element->GetText();
|
||||
|
||||
for (XMLElement* addressmapping = addressmappings->FirstChildElement("addressmapping"); addressmapping != NULL;
|
||||
addressmapping = addressmapping->NextSiblingElement("addressmapping"))
|
||||
{
|
||||
addressmappingUri = element->GetText();
|
||||
for (XMLElement* element = simulation->FirstChildElement("memconfigs")->FirstChildElement("memconfig");
|
||||
element != NULL; element = element->NextSiblingElement("memconfig"))
|
||||
// addressmappingUri = element->GetText();
|
||||
|
||||
for (XMLElement* memconfig = memconfigs->FirstChildElement("memconfig");
|
||||
memconfig != NULL; memconfig = memconfig->NextSiblingElement("memconfig"))
|
||||
{
|
||||
batch.dramSetups.push_back(DramSetup(element->GetText(), memspecUri, addressmappingUri));
|
||||
batch.dramSetups.push_back(DramSetup(memspec, memconfig, simconfig, addressmapping));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (XMLElement* element = simulation->FirstChildElement("trace-setups")->FirstChildElement("trace-setup"); element != NULL;
|
||||
element = element->NextSiblingElement("trace-setup"))
|
||||
XMLElement* tracesetups = simulation->FirstChildElement("tracesetups");
|
||||
if(tracesetups == NULL) tracesetups = simulation;
|
||||
|
||||
for (XMLElement* tracesetup = tracesetups->FirstChildElement("tracesetup"); tracesetup != NULL;
|
||||
tracesetup = tracesetup->NextSiblingElement("tracesetup"))
|
||||
{
|
||||
addTraceSetup(batch, element);
|
||||
addTraceSetup(batch, tracesetup);
|
||||
}
|
||||
|
||||
simulationsBatches.push_back(batch);
|
||||
simulationBatches.push_back(batch);
|
||||
|
||||
}
|
||||
|
||||
@@ -133,9 +150,9 @@ void SimulationManager::startTraceAnalyzer()
|
||||
{
|
||||
string p = getenv("trace");
|
||||
string run_tpr = p + " -f ";
|
||||
for (auto batch : simulationsBatches)
|
||||
for (auto batch : simulationBatches)
|
||||
{
|
||||
run_tpr += exportPath + "/" + batch.simulationName + " ";
|
||||
// run_tpr += exportPath + "/" + batch.simulationName + " ";
|
||||
|
||||
}
|
||||
run_tpr += "&";
|
||||
|
||||
Reference in New Issue
Block a user