diff options
author | Bjoern B. Brandenburg <bbb@cs.unc.edu> | 2008-11-02 16:43:50 -0500 |
---|---|---|
committer | Bjoern B. Brandenburg <bbb@cs.unc.edu> | 2008-11-02 16:43:50 -0500 |
commit | 422627a1b86cf61b66076c76b1ae89b41b52463e (patch) | |
tree | ff188352c2159afd505e94a86de4b0b23a4ff4bc | |
parent | 0b850b10de844c4dba7781ef9cef5827e2138baf (diff) |
speed up not_edf(), produce some output
-rw-r--r-- | pl/rules.pl | 36 |
1 files changed, 34 insertions, 2 deletions
diff --git a/pl/rules.pl b/pl/rules.pl index 4aeada0..bf9a036 100644 --- a/pl/rules.pl +++ b/pl/rules.pl | |||
@@ -27,6 +27,10 @@ running_at(Job, Time) :- | |||
27 | Start =< Time, | 27 | Start =< Time, |
28 | Stop > Time. | 28 | Stop > Time. |
29 | 29 | ||
30 | last_scheduled(Job, A, B) :- | ||
31 | setof((X, Y), scheduled(Job, X, Y), Bag), | ||
32 | last(Bag, (A, B)). | ||
33 | |||
30 | selected_in(Job, Start, End, Point) :- | 34 | selected_in(Job, Start, End, Point) :- |
31 | scheduled(Job, X, _Y), | 35 | scheduled(Job, X, _Y), |
32 | in_range(Start, End, X), | 36 | in_range(Start, End, X), |
@@ -129,7 +133,6 @@ not_work_conserving_on(Cpus, Violations) :- | |||
129 | 133 | ||
130 | not_edf(Job, Violator, Violation) :- | 134 | not_edf(Job, Violator, Violation) :- |
131 | test_range(Job, Rel, Done), | 135 | test_range(Job, Rel, Done), |
132 | earlier_deadline(Job, Violator), | ||
133 | ( | 136 | ( |
134 | ( | 137 | ( |
135 | selected_in(Violator, Rel, Done, Violation), | 138 | selected_in(Violator, Rel, Done, Violation), |
@@ -139,11 +142,40 @@ not_edf(Job, Violator, Violation) :- | |||
139 | preempted_in(Job, Rel, Done, Violation), | 142 | preempted_in(Job, Rel, Done, Violation), |
140 | running_at(Violator, Violation) | 143 | running_at(Violator, Violation) |
141 | ) | 144 | ) |
142 | ). | 145 | ), |
146 | earlier_deadline(Job, Violator). | ||
143 | 147 | ||
144 | edf_violations(Violations) :- | 148 | edf_violations(Violations) :- |
145 | bagof((Job, V, Vt), not_edf(Job, V, Vt), Violations). | 149 | bagof((Job, V, Vt), not_edf(Job, V, Vt), Violations). |
146 | 150 | ||
151 | show_job(Job) :- | ||
152 | (completed(Job, C) -> X = C ; X = '[never]'), | ||
153 | (deadline(Job, D) -> Y = D ; Y = '[never]'), | ||
154 | (released(Job, R) -> Z = R ; Z = '[never]'), | ||
155 | write(Job), | ||
156 | write(' R='), write(Z), | ||
157 | write(' D='), write(Y), | ||
158 | write(' C='), write(X). | ||
159 | |||
160 | show_sched_at(Job, At) :- | ||
161 | scheduled(Job, X, Y), | ||
162 | X =< At, Y > At, | ||
163 | write(' S=('), write(X), write(', '), write(Y), write(')'). | ||
164 | show_sched_at(_, _) :- | ||
165 | write(' S=[none]'). | ||
166 | |||
167 | list_violations([]). | ||
168 | list_violations([(Job, V, Vt)|Rest]) :- | ||
169 | completed(Job, _A),completed(V, _B), | ||
170 | write(Vt), write(': '), | ||
171 | nl, write('\t'), show_job(V), show_sched_at(V, Vt), write(' before '), | ||
172 | nl, write('\t'), show_job(Job), show_sched_at(Job, Vt), nl, | ||
173 | list_violations(Rest). | ||
174 | list_violations([(Job, _, _)|Rest]) :- | ||
175 | write('skip '), write(Job), nl, | ||
176 | list_violations(Rest). | ||
177 | list_edf_violations :- | ||
178 | edf_violations(X), list_violations(X). | ||
147 | 179 | ||
148 | periodic :- \+ not_periodic(_Job, _Skew). | 180 | periodic :- \+ not_periodic(_Job, _Skew). |
149 | sporadic :- \+ not_sporadic(_Job, _Skew). | 181 | sporadic :- \+ not_sporadic(_Job, _Skew). |