diff options
author | Alexander Wieder <awieder@mpi-sws.org> | 2013-04-29 02:22:44 -0400 |
---|---|---|
committer | Bjoern Brandenburg <bbb@mpi-sws.org> | 2013-12-13 02:39:07 -0500 |
commit | f56c28eac1ee6a54933e4e69da67f8890d2c901b (patch) | |
tree | e382297fd0b34a3eedf579b3afcbb8043faa5bef | |
parent | cc93ec973cc14ba5ab4c778efd5267df074b0540 (diff) |
incorporated request priority into C++ resource model
-rw-r--r-- | native/include/sharedres_types.h | 22 | ||||
-rw-r--r-- | schedcat/locking/bounds.py | 6 |
2 files changed, 18 insertions, 10 deletions
diff --git a/native/include/sharedres_types.h b/native/include/sharedres_types.h index 800659a..714ec61 100644 --- a/native/include/sharedres_types.h +++ b/native/include/sharedres_types.h | |||
@@ -26,18 +26,21 @@ private: | |||
26 | unsigned int request_length; | 26 | unsigned int request_length; |
27 | const TaskInfo* task; | 27 | const TaskInfo* task; |
28 | request_type_t request_type; | 28 | request_type_t request_type; |
29 | unsigned int request_priority; | ||
29 | 30 | ||
30 | public: | 31 | public: |
31 | RequestBound(unsigned int res_id, | 32 | RequestBound(unsigned int res_id, |
32 | unsigned int num, | 33 | unsigned int num, |
33 | unsigned int length, | 34 | unsigned int length, |
34 | const TaskInfo* tsk, | 35 | const TaskInfo* tsk, |
35 | request_type_t type = WRITE) | 36 | request_type_t type = WRITE, |
37 | unsigned int priority = 0) | ||
36 | : resource_id(res_id), | 38 | : resource_id(res_id), |
37 | num_requests(num), | 39 | num_requests(num), |
38 | request_length(length), | 40 | request_length(length), |
39 | task(tsk), | 41 | task(tsk), |
40 | request_type(type) | 42 | request_type(type), |
43 | request_priority(priority) | ||
41 | {} | 44 | {} |
42 | 45 | ||
43 | unsigned int get_max_num_requests(unsigned long interval) const; | 46 | unsigned int get_max_num_requests(unsigned long interval) const; |
@@ -48,6 +51,8 @@ public: | |||
48 | 51 | ||
49 | request_type_t get_request_type() const { return request_type; } | 52 | request_type_t get_request_type() const { return request_type; } |
50 | 53 | ||
54 | unsigned int get_request_priority() const { return request_priority; } | ||
55 | |||
51 | bool is_read() const { return get_request_type() == READ; } | 56 | bool is_read() const { return get_request_type() == READ; } |
52 | bool is_write() const { return get_request_type() == WRITE; } | 57 | bool is_write() const { return get_request_type() == WRITE; } |
53 | 58 | ||
@@ -82,9 +87,10 @@ public: | |||
82 | void add_request(unsigned int res_id, | 87 | void add_request(unsigned int res_id, |
83 | unsigned int num, | 88 | unsigned int num, |
84 | unsigned int length, | 89 | unsigned int length, |
85 | request_type_t type = WRITE) | 90 | request_type_t type = WRITE, |
91 | unsigned int priority = 0) | ||
86 | { | 92 | { |
87 | requests.push_back(RequestBound(res_id, num, length, this, type)); | 93 | requests.push_back(RequestBound(res_id, num, length, this, type, priority)); |
88 | } | 94 | } |
89 | 95 | ||
90 | const Requests& get_requests() const | 96 | const Requests& get_requests() const |
@@ -160,7 +166,8 @@ public: | |||
160 | 166 | ||
161 | void add_request(unsigned int resource_id, | 167 | void add_request(unsigned int resource_id, |
162 | unsigned int max_num, | 168 | unsigned int max_num, |
163 | unsigned int max_length) | 169 | unsigned int max_length, |
170 | unsigned int locking_priority = 0) | ||
164 | { | 171 | { |
165 | assert(!tasks.empty()); | 172 | assert(!tasks.empty()); |
166 | 173 | ||
@@ -171,13 +178,14 @@ public: | |||
171 | void add_request_rw(unsigned int resource_id, | 178 | void add_request_rw(unsigned int resource_id, |
172 | unsigned int max_num, | 179 | unsigned int max_num, |
173 | unsigned int max_length, | 180 | unsigned int max_length, |
174 | int type) | 181 | int type, |
182 | unsigned int locking_priority = 0) | ||
175 | { | 183 | { |
176 | assert(!tasks.empty()); | 184 | assert(!tasks.empty()); |
177 | assert(type == WRITE || type == READ); | 185 | assert(type == WRITE || type == READ); |
178 | 186 | ||
179 | TaskInfo& last_added = tasks.back(); | 187 | TaskInfo& last_added = tasks.back(); |
180 | last_added.add_request(resource_id, max_num, max_length, (request_type_t) type); | 188 | last_added.add_request(resource_id, max_num, max_length, (request_type_t) type, locking_priority); |
181 | } | 189 | } |
182 | 190 | ||
183 | }; | 191 | }; |
diff --git a/schedcat/locking/bounds.py b/schedcat/locking/bounds.py index 8091eb7..22c1e07 100644 --- a/schedcat/locking/bounds.py +++ b/schedcat/locking/bounds.py | |||
@@ -11,7 +11,7 @@ def get_cpp_model(all_tasks, use_task_period=False): | |||
11 | for req in t.resmodel: | 11 | for req in t.resmodel: |
12 | req = t.resmodel[req] | 12 | req = t.resmodel[req] |
13 | if req.max_requests > 0: | 13 | if req.max_requests > 0: |
14 | rsi.add_request_rw(req.res_id, req.max_requests, req.max_length, cpp.WRITE) | 14 | rsi.add_request_rw(req.res_id, req.max_requests, req.max_length, cpp.WRITE, t.locking_prio) |
15 | return rsi | 15 | return rsi |
16 | 16 | ||
17 | def get_cpp_model_rw(all_tasks, use_task_period=False): | 17 | def get_cpp_model_rw(all_tasks, use_task_period=False): |
@@ -24,9 +24,9 @@ def get_cpp_model_rw(all_tasks, use_task_period=False): | |||
24 | for req in t.resmodel: | 24 | for req in t.resmodel: |
25 | req = t.resmodel[req] | 25 | req = t.resmodel[req] |
26 | if req.max_writes > 0: | 26 | if req.max_writes > 0: |
27 | rsi.add_request_rw(req.res_id, req.max_writes, req.max_write_length, cpp.WRITE) | 27 | rsi.add_request_rw(req.res_id, req.max_writes, req.max_write_length, cpp.WRITE, t.locking_prio) |
28 | if req.max_reads > 0: | 28 | if req.max_reads > 0: |
29 | rsi.add_request_rw(req.res_id, req.max_reads, req.max_read_length, cpp.READ) | 29 | rsi.add_request_rw(req.res_id, req.max_reads, req.max_read_length, cpp.READ, t.locking_prio) |
30 | return rsi | 30 | return rsi |
31 | 31 | ||
32 | def assign_edf_locking_prios(all_tasks): | 32 | def assign_edf_locking_prios(all_tasks): |