diff options
author | Bjoern Brandenburg <bbb@mpi-sws.org> | 2012-12-12 05:53:40 -0500 |
---|---|---|
committer | Bjoern Brandenburg <bbb@mpi-sws.org> | 2013-02-12 06:55:16 -0500 |
commit | 762565248b57d39bac5934da627f09d17e12df8c (patch) | |
tree | 9cad046d9dc0bb59c580b77b60613b1c661d4d0e | |
parent | e317c5e5ff5bb7292fb9866913cae5688dc77094 (diff) |
blocking bounds: return C++ results object to caller
This is useful for testing.
-rw-r--r-- | schedcat/locking/bounds.py | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/schedcat/locking/bounds.py b/schedcat/locking/bounds.py index 9e7601c..3f31f89 100644 --- a/schedcat/locking/bounds.py +++ b/schedcat/locking/bounds.py | |||
@@ -64,6 +64,8 @@ def apply_mpcp_bounds(all_tasks, use_virtual_spin=False): | |||
64 | t.blocked = res.get_blocking_term(i) | 64 | t.blocked = res.get_blocking_term(i) |
65 | t.locally_blocked = res.get_local_blocking(i) | 65 | t.locally_blocked = res.get_local_blocking(i) |
66 | 66 | ||
67 | return res | ||
68 | |||
67 | def get_round_robin_resource_mapping(num_resources, num_cpus, | 69 | def get_round_robin_resource_mapping(num_resources, num_cpus, |
68 | dedicated_irq=cpp.NO_CPU): | 70 | dedicated_irq=cpp.NO_CPU): |
69 | "Default resource assignment: just assign resources to CPUs in index order." | 71 | "Default resource assignment: just assign resources to CPUs in index order." |
@@ -95,6 +97,8 @@ def apply_dpcp_bounds(all_tasks, resource_mapping, | |||
95 | # all blocking, including arrival blocking | 97 | # all blocking, including arrival blocking |
96 | t.blocked = res.get_blocking_term(i) | 98 | t.blocked = res.get_blocking_term(i) |
97 | 99 | ||
100 | return res | ||
101 | |||
98 | def apply_part_fmlp_bounds(all_tasks, preemptive=True): | 102 | def apply_part_fmlp_bounds(all_tasks, preemptive=True): |
99 | model = get_cpp_model(all_tasks) | 103 | model = get_cpp_model(all_tasks) |
100 | res = cpp.part_fmlp_bounds(model, preemptive) | 104 | res = cpp.part_fmlp_bounds(model, preemptive) |
@@ -106,6 +110,8 @@ def apply_part_fmlp_bounds(all_tasks, preemptive=True): | |||
106 | t.blocked = res.get_blocking_term(i) | 110 | t.blocked = res.get_blocking_term(i) |
107 | t.local_blocking_count = res.get_local_count(i) | 111 | t.local_blocking_count = res.get_local_count(i) |
108 | 112 | ||
113 | return res | ||
114 | |||
109 | # S-oblivious bounds | 115 | # S-oblivious bounds |
110 | 116 | ||
111 | def apply_suspension_oblivious(all_tasks, res): | 117 | def apply_suspension_oblivious(all_tasks, res): |
@@ -123,23 +129,27 @@ def apply_global_fmlp_sob_bounds(all_tasks): | |||
123 | model = get_cpp_model(all_tasks) | 129 | model = get_cpp_model(all_tasks) |
124 | res = cpp.global_fmlp_bounds(model) | 130 | res = cpp.global_fmlp_bounds(model) |
125 | apply_suspension_oblivious(all_tasks, res) | 131 | apply_suspension_oblivious(all_tasks, res) |
132 | return res | ||
126 | 133 | ||
127 | def apply_global_omlp_bounds(all_tasks, num_cpus): | 134 | def apply_global_omlp_bounds(all_tasks, num_cpus): |
128 | model = get_cpp_model(all_tasks) | 135 | model = get_cpp_model(all_tasks) |
129 | res = cpp.global_omlp_bounds(model, num_cpus) | 136 | res = cpp.global_omlp_bounds(model, num_cpus) |
130 | apply_suspension_oblivious(all_tasks, res) | 137 | apply_suspension_oblivious(all_tasks, res) |
138 | return res | ||
131 | 139 | ||
132 | def apply_clustered_omlp_bounds(all_tasks, procs_per_cluster, | 140 | def apply_clustered_omlp_bounds(all_tasks, procs_per_cluster, |
133 | dedicated_irq=cpp.NO_CPU): | 141 | dedicated_irq=cpp.NO_CPU): |
134 | model = get_cpp_model(all_tasks) | 142 | model = get_cpp_model(all_tasks) |
135 | res = cpp.clustered_omlp_bounds(model, procs_per_cluster, dedicated_irq) | 143 | res = cpp.clustered_omlp_bounds(model, procs_per_cluster, dedicated_irq) |
136 | apply_suspension_oblivious(all_tasks, res) | 144 | apply_suspension_oblivious(all_tasks, res) |
145 | return res | ||
137 | 146 | ||
138 | def apply_clustered_rw_omlp_bounds(all_tasks, procs_per_cluster, | 147 | def apply_clustered_rw_omlp_bounds(all_tasks, procs_per_cluster, |
139 | dedicated_irq=cpp.NO_CPU): | 148 | dedicated_irq=cpp.NO_CPU): |
140 | model = get_cpp_model_rw(all_tasks) | 149 | model = get_cpp_model_rw(all_tasks) |
141 | res = cpp.clustered_rw_omlp_bounds(model, procs_per_cluster, dedicated_irq) | 150 | res = cpp.clustered_rw_omlp_bounds(model, procs_per_cluster, dedicated_irq) |
142 | apply_suspension_oblivious(all_tasks, res) | 151 | apply_suspension_oblivious(all_tasks, res) |
152 | return res | ||
143 | 153 | ||
144 | def apply_clustered_kx_omlp_bounds(all_tasks, procs_per_cluster, | 154 | def apply_clustered_kx_omlp_bounds(all_tasks, procs_per_cluster, |
145 | replication_degrees = {}, | 155 | replication_degrees = {}, |
@@ -151,6 +161,7 @@ def apply_clustered_kx_omlp_bounds(all_tasks, procs_per_cluster, | |||
151 | res = cpp.clustered_kx_omlp_bounds(model, replica_info, procs_per_cluster, | 161 | res = cpp.clustered_kx_omlp_bounds(model, replica_info, procs_per_cluster, |
152 | dedicated_irq) | 162 | dedicated_irq) |
153 | apply_suspension_oblivious(all_tasks, res) | 163 | apply_suspension_oblivious(all_tasks, res) |
164 | return res | ||
154 | 165 | ||
155 | # spinlocks are charged similarly to s-oblivious analysis | 166 | # spinlocks are charged similarly to s-oblivious analysis |
156 | 167 | ||
@@ -159,6 +170,7 @@ def apply_task_fair_mutex_bounds(all_tasks, procs_per_cluster, | |||
159 | model = get_cpp_model(all_tasks) | 170 | model = get_cpp_model(all_tasks) |
160 | res = cpp.task_fair_mutex_bounds(model, procs_per_cluster, dedicated_irq) | 171 | res = cpp.task_fair_mutex_bounds(model, procs_per_cluster, dedicated_irq) |
161 | apply_suspension_oblivious(all_tasks, res) | 172 | apply_suspension_oblivious(all_tasks, res) |
173 | return res | ||
162 | 174 | ||
163 | def apply_task_fair_rw_bounds(all_tasks, procs_per_cluster, | 175 | def apply_task_fair_rw_bounds(all_tasks, procs_per_cluster, |
164 | dedicated_irq=cpp.NO_CPU): | 176 | dedicated_irq=cpp.NO_CPU): |
@@ -167,12 +179,14 @@ def apply_task_fair_rw_bounds(all_tasks, procs_per_cluster, | |||
167 | model_mtx = get_cpp_model(all_tasks) | 179 | model_mtx = get_cpp_model(all_tasks) |
168 | res = cpp.task_fair_rw_bounds(model, model_mtx, procs_per_cluster, dedicated_irq) | 180 | res = cpp.task_fair_rw_bounds(model, model_mtx, procs_per_cluster, dedicated_irq) |
169 | apply_suspension_oblivious(all_tasks, res) | 181 | apply_suspension_oblivious(all_tasks, res) |
182 | return res | ||
170 | 183 | ||
171 | def apply_phase_fair_rw_bounds(all_tasks, procs_per_cluster, | 184 | def apply_phase_fair_rw_bounds(all_tasks, procs_per_cluster, |
172 | dedicated_irq=cpp.NO_CPU): | 185 | dedicated_irq=cpp.NO_CPU): |
173 | model = get_cpp_model_rw(all_tasks) | 186 | model = get_cpp_model_rw(all_tasks) |
174 | res = cpp.phase_fair_rw_bounds(model, procs_per_cluster, dedicated_irq) | 187 | res = cpp.phase_fair_rw_bounds(model, procs_per_cluster, dedicated_irq) |
175 | apply_suspension_oblivious(all_tasks, res) | 188 | apply_suspension_oblivious(all_tasks, res) |
189 | return res | ||
176 | 190 | ||
177 | 191 | ||
178 | 192 | ||
@@ -211,6 +225,7 @@ def apply_lp_dflp_bounds(all_tasks, resource_mapping, | |||
211 | for i, t in enumerate(all_tasks): | 225 | for i, t in enumerate(all_tasks): |
212 | t.suspended = res.get_remote_blocking(i) | 226 | t.suspended = res.get_remote_blocking(i) |
213 | t.blocked = res.get_blocking_term(i) | 227 | t.blocked = res.get_blocking_term(i) |
228 | return res | ||
214 | 229 | ||
215 | def apply_lp_dpcp_bounds(all_tasks, resource_mapping, | 230 | def apply_lp_dpcp_bounds(all_tasks, resource_mapping, |
216 | use_rta = True, use_py=False): | 231 | use_rta = True, use_py=False): |
@@ -223,6 +238,8 @@ def apply_lp_dpcp_bounds(all_tasks, resource_mapping, | |||
223 | for i, t in enumerate(all_tasks): | 238 | for i, t in enumerate(all_tasks): |
224 | t.suspended = res.get_remote_blocking(i) | 239 | t.suspended = res.get_remote_blocking(i) |
225 | t.blocked = res.get_blocking_term(i) | 240 | t.blocked = res.get_blocking_term(i) |
241 | return res | ||
242 | |||
226 | 243 | ||
227 | def apply_lp_mpcp_bounds(all_tasks): | 244 | def apply_lp_mpcp_bounds(all_tasks): |
228 | model = get_cpp_model(all_tasks) | 245 | model = get_cpp_model(all_tasks) |
@@ -235,6 +252,8 @@ def apply_lp_mpcp_bounds(all_tasks): | |||
235 | t.blocked = res.get_blocking_term(i) | 252 | t.blocked = res.get_blocking_term(i) |
236 | t.locally_blocked = res.get_local_blocking(i) | 253 | t.locally_blocked = res.get_local_blocking(i) |
237 | 254 | ||
255 | return res | ||
256 | |||
238 | def apply_lp_part_fmlp_bounds(all_tasks): | 257 | def apply_lp_part_fmlp_bounds(all_tasks): |
239 | # LP-based analysis of the partitioned, preemptive FMLP+ | 258 | # LP-based analysis of the partitioned, preemptive FMLP+ |
240 | model = get_cpp_model(all_tasks) | 259 | model = get_cpp_model(all_tasks) |
@@ -247,3 +266,4 @@ def apply_lp_part_fmlp_bounds(all_tasks): | |||
247 | t.blocked = res.get_blocking_term(i) | 266 | t.blocked = res.get_blocking_term(i) |
248 | t.locally_blocked = res.get_local_blocking(i) | 267 | t.locally_blocked = res.get_local_blocking(i) |
249 | 268 | ||
269 | return res | ||