Attention une mise à jour du serveur va être effectuée le lundi 17 mai entre 13h et 13h30. Cette mise à jour va générer une interruption du service de quelques minutes.

Commit e1838781 authored by EYRAUD-DUBOIS Lionel's avatar EYRAUD-DUBOIS Lionel

Comments and reordering in schedAction file

parent c508205c
......@@ -4,6 +4,8 @@
using namespace std;
/* Action Sequence: list of actions, performed in sequence */
void ActionSequence::add(SchedAction* a) {
actions.push_back(a);
}
......@@ -38,6 +40,8 @@ int ActionSequence::chooseTask(int wType, double now) {
return SCHEDACTION_NONE;
}
/* ExportSchedule: exports a schedule */
ExportSchedule::ExportSchedule(ostream *stream, Instance* ins, bool header, string name) : output(stream), instance(ins), name(name) {
if(header) outputHeader();
}
......@@ -45,24 +49,12 @@ ExportSchedule::ExportSchedule(Instance* ins, string name)
: instance(ins), name(name) {
}
ExportToFile::ExportToFile(string filename, Instance* ins, bool header, string name): ExportSchedule(ins, name), f(new ofstream(filename, ios::app)) {
output = f;
if(header) outputHeader();
}
ExportToString::ExportToString(Instance* ins, bool header, string name)
: ExportSchedule(ins, name), f(new ostringstream()) {
output = f;
if(header) outputHeader();
}
void ExportSchedule::outputHeader() {
if(name != "")
if(name != "")
*output << "sched ";
*output << "Tid worker taskType ";
if(instance->taskIDs.size() > 0)
*output << "JobId ";
*output << "Tid worker taskType ";
if(instance->taskIDs.size() > 0)
*output << "JobId ";
*output << "start duration end" << endl;
}
......@@ -71,30 +63,48 @@ void ExportSchedule::changeName(string newName) {
cerr << "ExportSchedule: Warning, adding a name after the start breaks the header" << endl;
}
if(name != "" && newName == "") newName = "NA";
name = newName;
name = newName;
}
void ExportSchedule::onSchedule(int i, int w, double s, double f) {
if(name != "")
*output << name << " ";
*output << i << " " << w << " ";
if(instance->taskTypeNames.size() > 0)
*output << instance->taskTypeNames[instance->taskTypes[i]];
else
*output << instance->taskTypes[i];
if(instance->taskIDs.size() > 0)
*output << " " << instance->taskIDs[i];
*output << name << " ";
*output << i << " " << w << " ";
if(instance->taskTypeNames.size() > 0)
*output << instance->taskTypeNames[instance->taskTypes[i]];
else
*output << instance->taskTypes[i];
if(instance->taskIDs.size() > 0)
*output << " " << instance->taskIDs[i];
*output << " " << s << " " << (f - s) << " " << f << endl;
}
/* ExportToFile */
ExportToFile::ExportToFile(string filename, Instance* ins, bool header, string name): ExportSchedule(ins, name), f(new ofstream(filename, ios::app)) {
output = f;
if(header) outputHeader();
}
ExportToFile::~ExportToFile() {
f->close();
}
/* ExportToString */
ExportToString::ExportToString(Instance* ins, bool header, string name)
: ExportSchedule(ins, name), f(new ostringstream()) {
output = f;
if(header) outputHeader();
}
string ExportToString::getResult() {
return f->str();
}
/* ExportAlloc: exports in .rec format */
ExportAlloc::ExportAlloc(string filename, Instance* ins) : output(filename), instance(ins) {
}
......@@ -119,6 +129,8 @@ ExportAlloc::~ExportAlloc() {
output.close();
}
/* UtilAnalysis: compute stats about a schedule */
UtilAnalysis::UtilAnalysis(Instance* _ins, string saveFile) :
ins(_ins), repartition(_ins->nbWorkerTypes,
......@@ -155,6 +167,7 @@ void UtilAnalysis::write(string prefix) {
reset();
}
/* InternalShare: sharing schedules internally between algorithms */
InternalShare::InternalShare(string name, Instance* ins) :
shareName(name), instance(ins), allocation(ins->nbTasks, -1),
......@@ -177,6 +190,8 @@ void InternalShare::finish() {
instance->extraData.insert(shareName + "[end]", new vector<double>(endTimes));
}
/* ExportBubble: deprecated */
ExportBubble::ExportBubble(string filename, Instance* ins, int btt) :
InternalShare(filename, ins), output(filename), bubbleTaskType(btt) {
}
......
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