-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtask.cpp
More file actions
184 lines (176 loc) · 3.02 KB
/
Copy pathtask.cpp
File metadata and controls
184 lines (176 loc) · 3.02 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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
/*
* task.cpp
*
* Created on: Mar 7, 2013
* Author: ashish
*/
#include"task.h"
#include<iostream>
#include<algorithm>
using namespace std;
void TASK::printTaskParameters(void)
{
cout<<"\ntaskid: "<<this->getTaskId();
cout<<"\nphase: "<<this->getPhase();
cout<<"\nperiod: "<<this->getPeriod();
cout<<"\nexecution: "<<this->getExecution();
cout<<"\ndeadline: "<<this->getDeadline();
cout<<"\npriority: "<<this->getPriority();
cout<<"\nutilization: "<<this->getUtilization();
cout<<"\ndensity: "<<this->getDensity();
cout<<"\nqos: "<<this->getQos()<<endl;
}
TASK::TASK()
{
taskid=0;
phase=0;
period=0;
execution=0;
deadline=0;
priority=0;
utilization=0.0;
qos=0;
currExecution=0;
status = 0;
density=0.0;
minRespTime=0;
maxRespTime=0;
}
TASK::~TASK(){}
int TASK::getTaskId(void)
{
return taskid;
}
int TASK::getPhase(void)
{
return phase;
}
int TASK::getPeriod(void)
{
return period;
}
int TASK::getExecution(void)
{
return execution;
}
int TASK::getDeadline(void)
{
return deadline;
}
int TASK::getStaticDeadline(void)
{
return staticdeadline;
}
float TASK::getPriority(void)
{
return priority;
}
float TASK::getQos(void)
{
return qos;
}
float TASK::getUtilization(void)
{
return utilization;
}
float TASK::getDensity(void)
{
return density;
}
int TASK::getCurrExecution(void)
{
return currExecution;
}
int TASK::getNextFireAt(void)
{
return nextFireAt;
}
int TASK::getStatus(void)
{
return status;
}
int TASK::getMinRespTime(void)
{
return minRespTime;
}
int TASK::getMaxRespTime(void)
{
return maxRespTime;
}
/*------------------------------------*/
void TASK::setTaskId(int _taskid)
{
taskid = _taskid;
}
void TASK::setPhase(int _phase)
{
phase = _phase;
}
void TASK::setPeriod(int _period)
{
period = _period;
minRespTime = period;
}
void TASK::setExecution(int _execution)
{
execution = _execution;
maxRespTime = execution;
}
void TASK::setDeadline(int _deadline)
{
deadline = _deadline;
}
void TASK::setStaticDeadline(int _staticdeadline)
{
staticdeadline = deadline;
}
void TASK::setPriority(float _priority)
{
priority = _priority;
}
void TASK::setUtilization(float _utilization)
{
utilization = _utilization;
}
void TASK::setDensity(float _density)
{
density = _density;
}
void TASK::setQos(float _qos)
{
qos = _qos;
}
void TASK::setCurrExecution(int _currExecution)
{
currExecution = _currExecution;
}
void TASK::resetCurrExecution(void)
{
currExecution = 0;
}
void TASK::setNextFireAt(int _nextFireAt)
{
nextFireAt = _nextFireAt;
}
void TASK::setStatus(int _status)
{
status = _status;
}
void TASK::updateUtilization_OR_Density(void)
{
if(this->getPeriod() > this->getDeadline())
{
this->setDensity((float)this->getExecution()/((float)this->getDeadline()));
this->setUtilization(0.0);
}
else if(this->getPeriod() == this->getDeadline())
{
this->setUtilization((float)this->getExecution()/((float)this->getPeriod()));
this->setDensity(0.0);
}
}
void TASK::insertMinMaxRespTime(int _ResponseTime)
{
maxRespTime = max(maxRespTime, _ResponseTime);
minRespTime = min(minRespTime, _ResponseTime);
}