-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcompute_Ws.m
54 lines (34 loc) · 876 Bytes
/
compute_Ws.m
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
% Gets interfering workloads for EDF and FP
% according to Bertogna
function tasks = compute_Ws(tasks)
tasks = assign_fixed_priorities(tasks); % for FP we use RM priorities
for index = 1:numel(tasks)
tasks(index).Wedf = get_W_edf(index, tasks);
tasks(index).Wfp = get_W_fp(index, tasks);
end
end
% get interfering workload Wk for GEDF
function Wi = get_W_edf(i, taskSet)
n = numel(taskSet);
Wi = 0;
Di = taskSet(i).D;
for j = 1:n
if (j ~= i)
Cj = taskSet(j).C;
Tj = taskSet(j).T;
Wi = Wi + floor(Di / Tj)*Cj + min(Cj, Di - floor(Di / Tj)*Tj);
end
end
end
function Wi = get_W_fp(i, tasks)
Wi = 0;
Di = tasks(i).D;
for j = 1:(i-1)
Cj = tasks(j).C;
Tj = tasks(j).T;
Dj = tasks(j).D;
Nji = floor((Di + Dj - Cj)/Tj);
Wji = Nji*Cj + min(Cj, Di + Dj - Cj - Nji*Tj);
Wi = Wi + Wji;
end
end