Mercurial > hg > Game > Cerium
comparison TaskManager/kernel/ppe/TaskManagerImpl.cc @ 1479:163220e54cc0 draft
remove hard code for TaskLog
author | Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp> |
---|---|
date | Tue, 24 Jul 2012 17:15:15 +0900 |
parents | b158873485f6 |
children | 85a848d7f181 |
comparison
equal
deleted
inserted
replaced
1478:beda5f2f88ce | 1479:163220e54cc0 |
---|---|
70 | 70 |
71 Task *t = new_task->next_task_array(cmd,0,8,1,1); | 71 Task *t = new_task->next_task_array(cmd,0,8,1,1); |
72 t->set_inData(0,rbuf,r_size); | 72 t->set_inData(0,rbuf,r_size); |
73 t->set_outData(0,wbuf,w_size); | 73 t->set_outData(0,wbuf,w_size); |
74 | 74 |
75 TaskLog *tasklog = new TaskLog(); // この hard code は、ひどい... state pattern で切れるようにしてよ。 | 75 new_task->export_task_log = _export_task_log; |
76 tasklog->set_cmd(cmd); | 76 if (_export_task_log) { |
77 taskLogQueue->addLast(tasklog); | 77 TaskLog *tasklog = new TaskLog(); |
78 new_task->tasklog = tasklog; | 78 tasklog->set_cmd(cmd); |
79 taskLogQueue->addLast(tasklog); | |
80 new_task->tasklog = tasklog; | |
81 } | |
79 | 82 |
80 #ifdef EARLY_TOUCH | 83 #ifdef EARLY_TOUCH |
81 if (rbuf) { | 84 if (rbuf) { |
82 if ((unsigned long)rbuf&0xf) { | 85 if ((unsigned long)rbuf&0xf) { |
83 printf("Data is not aligned. command = %d, addr = 0x%lx, size = %ld\n", | 86 printf("Data is not aligned. command = %d, addr = 0x%lx, size = %ld\n", |
113 // rbuf, r_size were set | 116 // rbuf, r_size were set |
114 new_task->command = TaskArray1; | 117 new_task->command = TaskArray1; |
115 new_task->from = (memaddr)from; | 118 new_task->from = (memaddr)from; |
116 new_task->next_task_array(cmd,0,8,1,1); | 119 new_task->next_task_array(cmd,0,8,1,1); |
117 | 120 |
118 TaskLog *tasklog = new TaskLog(); | 121 new_task->export_task_log = _export_task_log; |
119 tasklog->set_cmd(cmd); | 122 if (_export_task_log) { |
120 taskLogQueue->addLast(tasklog); | 123 TaskLog *tasklog = new TaskLog(); |
121 new_task->tasklog = tasklog; | 124 tasklog->set_cmd(cmd); |
125 taskLogQueue->addLast(tasklog); | |
126 new_task->tasklog = tasklog; | |
127 } | |
122 | 128 |
123 return new_task; | 129 return new_task; |
124 } | 130 } |
125 | 131 |
126 /** | 132 /** |
294 * @param [task] 終了したタスク | 300 * @param [task] 終了したタスク |
295 */ | 301 */ |
296 void | 302 void |
297 TaskManagerImpl::check_task_finish(HTaskPtr me, QueueInfo<HTask> *wait_queue) | 303 TaskManagerImpl::check_task_finish(HTaskPtr me, QueueInfo<HTask> *wait_queue) |
298 { | 304 { |
299 me->tasklog->finish_time = rdtsc(); | 305 if (_export_task_log) |
306 me->tasklog->finish_time = rdtsc(); | |
300 | 307 |
301 while(TaskQueue *p = me->wait_me->poll()) { | 308 while(TaskQueue *p = me->wait_me->poll()) { |
302 HTaskPtr you = p->task; | 309 HTaskPtr you = p->task; |
303 QueueInfo<TaskQueue> *wait_i = you->wait_i; | 310 QueueInfo<TaskQueue> *wait_i = you->wait_i; |
304 // 相手の wait queue から自分(を指しているTaskQueue)を削除 | 311 // 相手の wait queue から自分(を指しているTaskQueue)を削除 |
361 @param taskList | 368 @param taskList |
362 */ | 369 */ |
363 void | 370 void |
364 TaskManagerImpl::set_taskList(HTaskPtr htask, QueueInfo<TaskList> * taskList) | 371 TaskManagerImpl::set_taskList(HTaskPtr htask, QueueInfo<TaskList> * taskList) |
365 { | 372 { |
366 htask->tasklog->execute_time = rdtsc(); | 373 if (_export_task_log) |
374 htask->tasklog->execute_time = rdtsc(); | |
367 | 375 |
368 TaskListPtr tl = (TaskList*)htask->rbuf; | 376 TaskListPtr tl = (TaskList*)htask->rbuf; |
369 while(tl->prev) tl=tl->prev; | 377 while(tl->prev) tl=tl->prev; |
370 while(tl) { | 378 while(tl) { |
371 TaskListPtr next = tl->next; | 379 TaskListPtr next = tl->next; |