summaryrefslogtreecommitdiff
path: root/Simulator/src/simulation/workloads/Workload.cpp
blob: b6a3b2d0e6a74f51ac2b23c3c592844b07dc1b77 (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
#include "simulation/workloads/Workload.h"

#include <iostream>

namespace Simulation
{
	Workload::Workload(int size, int startTick, int dbId, int traceId, int dependency) : dependencyId(dependency), remainingFlops(size), TOTAL_FLOPS(size), START_TICK(startTick), ID(dbId), TRACE_ID(traceId) {}

	void Workload::doOperations(uint32_t opCount)
	{
		if (opCount < 0 || finished) return;

		if (remainingFlops <= opCount)
		{
			remainingFlops = 0;
			finished = true;
		}
		else
		{
			remainingFlops -= opCount;
		}
	}

	uint32_t Workload::getRemainingOperations() const
	{
		return remainingFlops;
	}

	uint32_t Workload::getTotalOperations() const
	{
		return TOTAL_FLOPS;
	}

	bool Workload::isFinished() const
	{
		return this->finished;
	}
	uint32_t Workload::getId() const
	{
		return ID;
	}

	int Workload::getDependencyId() const
	{
		return this->dependencyId;
	}
}