Commit 0b829c6d authored by EYRAUD-DUBOIS Lionel's avatar EYRAUD-DUBOIS Lionel

pmtool: new option 'bubble' to share results with Jerome

parent e7722cdb
......@@ -350,6 +350,12 @@ int main(int argc, char** argv) {
exportAlloc = new ExportAlloc(opts.asString("export"), instance);
seq.add(exportAlloc);
}
ExportBubble * exportBubble = NULL;
if(opts.isPresent("bubble")) {
exportBubble = new ExportBubble(opts.asString("bubble"), instance, opts.asInt("bubbleType"));
seq.add(exportBubble);
}
string name = buildName(it->first->name(), outputNamesRaw, optionKeys, it->second);
......@@ -399,6 +405,11 @@ int main(int argc, char** argv) {
seq.remove(share);
free(share);
}
if(exportBubble) {
exportBubble->finish();
seq.remove(exportBubble);
free(exportBubble);
}
}
if(globalExport) free(globalExport);
......
......@@ -150,3 +150,30 @@ void InternalShare::finish() {
instance->extraData[shareName + "[alloc]"] = new vector<int>(allocation);
instance->extraData[shareName + "[start]"] = new vector<double>(startTimes);
}
ExportBubble::ExportBubble(string filename, Instance* ins, int btt) :
InternalShare(filename, ins), output(filename), bubbleTaskType(btt) {
}
void ExportBubble::finish() {
vector<double> bubbleStarts;
vector<int> topOrder = instance->getTopOrder();
int nbBubbles;
for(int i = 0; i < instance->nbTasks; i++) {
if(instance->taskTypes[topOrder[i]] == bubbleTaskType)
bubbleStarts.push_back(startTimes[topOrder[i]]);
}
nbBubbles = bubbleStarts.size();
for(int i = 0; i < instance->nbTasks; i++) {
double s = startTimes[i], e = startTimes[i] + instance->execType(allocation[i], i);
int firstBubble = -1, lastBubble = -1;
for(int j = 0; j < nbBubbles; j++) {
if(s >= bubbleStarts[j]) firstBubble = j;
if(e >= bubbleStarts[j]) lastBubble = j;
else break;
}
output << firstBubble << " " << lastBubble << " " << allocation[i] << endl;
}
output.close();
}
......@@ -45,6 +45,7 @@ public:
~ExportAlloc();
};
class UtilAnalysis : public SchedAction {
Instance* ins;
std::vector<std::vector<int> > repartition;
......@@ -59,6 +60,7 @@ class UtilAnalysis : public SchedAction {
};
class InternalShare : public SchedAction {
protected:
std::string shareName;
Instance* instance;
std::vector<int> allocation;
......@@ -70,5 +72,13 @@ class InternalShare : public SchedAction {
void finish();
};
class ExportBubble: public InternalShare {
std::ofstream output;
int bubbleTaskType;
public:
ExportBubble(std::string fileName, Instance* ins, int bubbleTaskType);
void finish();
};
#endif
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