Commit 17160b2e authored by EYRAUD-DUBOIS Lionel's avatar EYRAUD-DUBOIS Lionel

pmtool: option 'export' to export allocs back to *PU

parent 8a400444
......@@ -345,6 +345,12 @@ int main(int argc, char** argv) {
seq.add(share);
}
ExportAlloc* exportAlloc = NULL;
if(opts.isPresent("export")) {
exportAlloc = new ExportAlloc(opts.asString("export"), instance);
seq.add(exportAlloc);
}
string name = buildName(it->first->name(), outputNamesRaw, optionKeys, it->second);
// In save files, always use raw names, please.
......@@ -384,6 +390,10 @@ int main(int argc, char** argv) {
seq.remove(localExport);
free(localExport);
}
if(exportAlloc) {
seq.remove(exportAlloc);
free(exportAlloc);
}
if(share) {
share->finish();
seq.remove(share);
......
......@@ -75,6 +75,31 @@ ExportToFile::~ExportToFile() {
output.close();
}
ExportAlloc::ExportAlloc(string filename, Instance* ins) : output(filename), instance(ins) {
}
void ExportAlloc::onSchedule(int i, int w, double s, double f) {
if(instance->taskIDs.size() > 0) {
output << "JobId: " << instance->taskIDs[i] << endl;
} else {
output << "TaskId: " << i << endl;
}
if(instance->taskTypeNames.size() > 0) {
output << "TaskType: " << instance->taskTypeNames[instance->taskTypes[i]] << endl;
}
if(instance->workerNames.size() > 0) {
output << "Architecture: " << instance->workerNames[instance->getType(w)] << endl;
} else {
output << "WorkerType: " << instance->getType(w) << endl;
}
output << endl;
}
ExportAlloc::~ExportAlloc() {
output.close();
}
UtilAnalysis::UtilAnalysis(Instance* _ins, string saveFile) :
ins(_ins), repartition(_ins->nbWorkerTypes,
std::vector<int>(ins->nbTaskTypes, 0)),
......
......@@ -36,6 +36,14 @@ public:
void changeName(std::string newName);
~ExportToFile();
};
class ExportAlloc : public SchedAction {
std::ofstream output;
Instance* instance;
public:
ExportAlloc(std::string filename, Instance* ins);
void onSchedule(int i, int w, double s, double f);
~ExportAlloc();
};
class UtilAnalysis : public SchedAction {
Instance* ins;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment