blob: 9de57990c513d7ac89d4168df571f4aefd54b9ea (
plain)
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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
|
#pragma once
#include <stdint.h>
namespace Simulation
{
/*
The Workload class models a workload.
*/
class Workload
{
public:
/*
Initializes the TOTAL_FLOPS and the remainingFlops to the size.
*/
Workload(int size, int startTick, int dbId, int traceId, int dependency);
/*
Decreases the remainingFlops by the given amount.
*/
void doOperations(uint32_t opCount);
/*
Returns the amount of operations left to do.
*/
uint32_t getRemainingOperations() const;
/*
Returns the total amount of operations, including finished ones.
*/
uint32_t getTotalOperations() const;
/*
Returns true if the workload has been finished.
*/
bool isFinished() const;
/*
Returns the id of this workload.
*/
uint32_t getId() const;
/*
Returns the dependency id of this workload.
*/
int getDependencyId() const;
/**
* \return The start tick of this workload.
*/
uint32_t getStartTick() const
{
return START_TICK;
}
// True if the dependency of this workload has finished.
bool dependencyFinished = false;
private:
// The id of the workload this workload depends on.
int dependencyId;
// Finished is true if the remainingFlops is 0.
bool finished = false;
// The amount of operations done.
uint32_t remainingFlops;
// The total amount of operations required to finish this task.
uint32_t TOTAL_FLOPS;
// The tick during which this workload was started.
uint32_t START_TICK;
// The id of this workload in the database
uint32_t ID;
// The id of the trace this workload belongs to in the database.
uint32_t TRACE_ID;
};
}
|