Commit 94649d4d by Tobias Langer

Generate arguments beforehand.

parent 73b26540
...@@ -125,6 +125,9 @@ static void IdleTask(const void* args, mtapi_size_t, void*, mtapi_size_t, ...@@ -125,6 +125,9 @@ static void IdleTask(const void* args, mtapi_size_t, void*, mtapi_size_t,
* Main loop of task starter core. * Main loop of task starter core.
****/ ****/
/* Make place to store the arguments for any running task instance. */
std::vector<std::pair<int,int>> task_arguments[taskset_length];
static void TaskStarter() static void TaskStarter()
{ {
/* Initialize task starter */ /* Initialize task starter */
...@@ -134,15 +137,10 @@ static void TaskStarter() ...@@ -134,15 +137,10 @@ static void TaskStarter()
auto hyperperiod = calculate_hyperperiod(); auto hyperperiod = calculate_hyperperiod();
/* Storage for task parameters. */
int task_cnt = 0;
for(int i = 0; i < taskset_length; i++) { for(int i = 0; i < taskset_length; i++) {
node.CreateAction(ACTION_ID + i + 1, IdleTask); node.CreateAction(ACTION_ID + i + 1, IdleTask);
task_cnt += hyperperiod / taskset[i].period;
std::cout << "Task " << i << " wcet: " << taskset[i].wcet << " period: " << taskset[i].period << " deadline: " << taskset[i].deadline << std::endl; std::cout << "Task " << i << " wcet: " << taskset[i].wcet << " period: " << taskset[i].period << " deadline: " << taskset[i].deadline << std::endl;
} }
std::vector<std::pair<int,int>> running_num(task_cnt);
int task_ptr = 0;
using namespace std::chrono; using namespace std::chrono;
...@@ -181,10 +179,10 @@ static void TaskStarter() ...@@ -181,10 +179,10 @@ static void TaskStarter()
* to make sure that all possible running tasks can access their * to make sure that all possible running tasks can access their
* parameters. * parameters.
*/ */
running_num[task_ptr++] = std::make_pair(i,count); task_arguments[i][count - 1] = std::make_pair(i,count);
auto job = node.GetJob(ACTION_ID + i + 1, DOMAIN_ID); auto job = node.GetJob(ACTION_ID + i + 1, DOMAIN_ID);
int tmp; auto t = node.Start(job, &running_num[task_ptr - 1], &tmp); int tmp; auto t = node.Start(job, &task_arguments[i][count - 1], &tmp);
/* Store task to wait for it. */ /* Store task to wait for it. */
running.push_back(t); running.push_back(t);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment