This commit is contained in:
2023-12-03 22:11:15 +03:00
parent 7ac88bc689
commit 2b0f534f5d
3 changed files with 41 additions and 5 deletions

View File

@@ -26,7 +26,8 @@ enum TaskState {
Queued, //16
NoSuchTask, //17
FailedToQueue, //18
AbortingByUser //19
AbortingByUser, //19
Unknown
};
enum TestType {
@@ -42,8 +43,9 @@ protected:
int maxtime;
int kernels; //получение зависит от типа задачи.
String workspace;
TaskState state;
TaskState state = Unknown;
std::chrono::system_clock::time_point start_time;
double total_time;
public:
String printState() {
@@ -88,13 +90,16 @@ public:
return String("FailedToQueue");
case AbortingByUser:
return String("AbortingByUser");
case Unknown:
return String("?");
default:
return "?";
}
}
//-------------->>
void setStart() { start_time = std::chrono::system_clock::now(); }
void setStart() { start_time = std::chrono::system_clock::now(); }
double getTotalTime() const { return total_time; }
long getId() { return id; }
long setId(String* id_s) {
@@ -181,6 +186,10 @@ public:
}
virtual void analyseResults() {
auto end_time = std::chrono::system_clock::now();
std::chrono::duration<double> diff_time = end_time - start_time;
total_time = diff_time.count();
printf("%ld done with time %f\n", id, total_time);
state = Finished;
}
@@ -188,4 +197,6 @@ public:
String stateFile = workspace + "/TaskState";
File tmp(stateFile, printState());
}
virtual void copyResults(const String& path) { }
};