aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBjoern Brandenburg <bbb@mpi-sws.org>2012-08-07 14:04:05 -0400
committerBjoern Brandenburg <bbb@mpi-sws.org>2013-02-12 06:49:39 -0500
commit52c28dbda3f4ef2241182e32002b710b1a9eae0b (patch)
treec2e47ffa32bfc042ec49694289ab2ea5963a1828
parent2e2370a21d65ee9ea7659f995fc5b553885646fc (diff)
Add unique IDs to TaskInfo
The LP code generates variable IDs based on task identity. It's convenient to keep track of this explicitly.
-rw-r--r--native/include/sharedres_types.h12
-rw-r--r--native/src/testmain.cpp2
2 files changed, 9 insertions, 5 deletions
diff --git a/native/include/sharedres_types.h b/native/include/sharedres_types.h
index fe190c6..898434c 100644
--- a/native/include/sharedres_types.h
+++ b/native/include/sharedres_types.h
@@ -63,18 +63,20 @@ private:
63 unsigned long period; 63 unsigned long period;
64 unsigned long response; 64 unsigned long response;
65 unsigned int cluster; 65 unsigned int cluster;
66 66 unsigned int id;
67 Requests requests; 67 Requests requests;
68 68
69public: 69public:
70 TaskInfo(unsigned long _period, 70 TaskInfo(unsigned long _period,
71 unsigned long _response, 71 unsigned long _response,
72 unsigned int _cluster, 72 unsigned int _cluster,
73 unsigned int _priority) 73 unsigned int _priority,
74 int _id)
74 : priority(_priority), 75 : priority(_priority),
75 period(_period), 76 period(_period),
76 response(_response), 77 response(_response),
77 cluster(_cluster) 78 cluster(_cluster),
79 id(_id)
78 {} 80 {}
79 81
80 void add_request(unsigned int res_id, 82 void add_request(unsigned int res_id,
@@ -90,6 +92,7 @@ public:
90 return requests; 92 return requests;
91 } 93 }
92 94
95 unsigned int get_id() const { return id; }
93 unsigned int get_priority() const { return priority; } 96 unsigned int get_priority() const { return priority; }
94 unsigned long get_period() const { return period; } 97 unsigned long get_period() const { return period; }
95 unsigned long get_response() const { return response; } 98 unsigned long get_response() const { return response; }
@@ -144,7 +147,8 @@ public:
144 { 147 {
145 // Avoid re-allocation! 148 // Avoid re-allocation!
146 assert(tasks.size() < tasks.capacity()); 149 assert(tasks.size() < tasks.capacity());
147 tasks.push_back(TaskInfo(period, response, cluster, priority)); 150 int id = tasks.size();
151 tasks.push_back(TaskInfo(period, response, cluster, priority, id));
148 } 152 }
149 153
150 void add_request(unsigned int resource_id, 154 void add_request(unsigned int resource_id,
diff --git a/native/src/testmain.cpp b/native/src/testmain.cpp
index 3c5dc24..d901446 100644
--- a/native/src/testmain.cpp
+++ b/native/src/testmain.cpp
@@ -722,7 +722,7 @@ int main6(int argc, char** argv)
722 722
723int main6(int argc, char** argv) 723int main6(int argc, char** argv)
724{ 724{
725 TaskInfo ti(100, 100, 0, 0); 725 TaskInfo ti(100, 100, 0, 0, 0);
726 726
727 ti.add_request(123, 3, 3); 727 ti.add_request(123, 3, 3);
728 ti.add_request(103, 1, 2); 728 ti.add_request(103, 1, 2);