-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtask.h
More file actions
executable file
·57 lines (47 loc) · 1.4 KB
/
task.h
File metadata and controls
executable file
·57 lines (47 loc) · 1.4 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
#pragma once
#include <iostream>
#include <queue>
#include <vector>
#include <any>
#include <functional>
#include "history.h"
#include "priorities.h"
enum class TaskExecutionMode {
SYNC,
ASYNC_FILE
};
class Task {
private:
static int last_task_id;
bool inherit_niceness = true;
bool inherit_result = true;
public:
int id;
void* input;
std::vector<Task*> next_tasks;
bool forward_result = true;
History history;
TaskExecutionMode exec_mode = TaskExecutionMode::SYNC;
int niceness = DEFAULT_NICENESS;
unsigned long long ticks = 0;
unsigned long long ftick = 0;
unsigned long long ltick = 0;
std::string group = "GRP0";
Task();
virtual void* process() = 0;
virtual Task* fork() = 0;
void setInput(void* input);
void setForwardResult(bool forward_result);
void setNextTasks(std::vector<Task*> next_tasks);
void setHistory(History history);
void setNiceness(int niceness);
void setTicks(unsigned long long ticks, unsigned long long ftick, unsigned long long ltick);
void setExecutionMode(TaskExecutionMode exec_mode);
void setGroup(std::string group);
void inherit_from_parent(Task* parent_task, void* parent_result);
void copy(Task* task);
int getInteractivityPenality();
int getPriority();
void updateCpuUtilization(unsigned long long total_ticks, bool run);
static int generate_task_id();
};