From 52c28dbda3f4ef2241182e32002b710b1a9eae0b Mon Sep 17 00:00:00 2001 From: Bjoern Brandenburg Date: Tue, 7 Aug 2012 20:04:05 +0200 Subject: Add unique IDs to TaskInfo The LP code generates variable IDs based on task identity. It's convenient to keep track of this explicitly. --- native/include/sharedres_types.h | 12 ++++++++---- native/src/testmain.cpp | 2 +- 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: unsigned long period; unsigned long response; unsigned int cluster; - + unsigned int id; Requests requests; public: TaskInfo(unsigned long _period, unsigned long _response, unsigned int _cluster, - unsigned int _priority) + unsigned int _priority, + int _id) : priority(_priority), period(_period), response(_response), - cluster(_cluster) + cluster(_cluster), + id(_id) {} void add_request(unsigned int res_id, @@ -90,6 +92,7 @@ public: return requests; } + unsigned int get_id() const { return id; } unsigned int get_priority() const { return priority; } unsigned long get_period() const { return period; } unsigned long get_response() const { return response; } @@ -144,7 +147,8 @@ public: { // Avoid re-allocation! assert(tasks.size() < tasks.capacity()); - tasks.push_back(TaskInfo(period, response, cluster, priority)); + int id = tasks.size(); + tasks.push_back(TaskInfo(period, response, cluster, priority, id)); } 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) int main6(int argc, char** argv) { - TaskInfo ti(100, 100, 0, 0); + TaskInfo ti(100, 100, 0, 0, 0); ti.add_request(123, 3, 3); ti.add_request(103, 1, 2); -- cgit v1.2.2