Mercurial > hg > Game > Cerium
comparison TaskManager/kernel/ppe/TaskManagerImpl.cc @ 1989:f4c16bdddee0 draft
fix tasklog
author | Shohei KOKUBO <e105744@ie.u-ryukyu.ac.jp> |
---|---|
date | Sat, 19 Apr 2014 13:51:54 +0900 |
parents | 94a824cde2e4 |
children | ac16a57f5dd7 |
comparison
equal
deleted
inserted
replaced
1988:f13abbbaaf72 | 1989:f4c16bdddee0 |
---|---|
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 new_task->export_task_log = _export_task_log; | |
76 if (_export_task_log) { | 75 if (_export_task_log) { |
77 TaskLog *tasklog = new TaskLog(); | 76 tasklog = new TaskLog(); |
78 tasklog->set_cmd(cmd); | 77 tasklog->set_cmd(cmd); |
79 taskLogQueue->addLast(tasklog); | 78 taskLogQueue->addLast(tasklog); |
80 new_task->tasklog = tasklog; | |
81 } | 79 } |
82 | 80 |
83 #ifdef EARLY_TOUCH | 81 #ifdef EARLY_TOUCH |
84 if (rbuf) { | 82 if (rbuf) { |
85 if ((unsigned long)rbuf&0xf) { | 83 if ((unsigned long)rbuf&0xf) { |
116 // rbuf, r_size were set | 114 // rbuf, r_size were set |
117 new_task->command = TaskArray1; | 115 new_task->command = TaskArray1; |
118 new_task->from = (memaddr)from; | 116 new_task->from = (memaddr)from; |
119 new_task->next_task_array(cmd,0,8,8,8); | 117 new_task->next_task_array(cmd,0,8,8,8); |
120 | 118 |
121 new_task->export_task_log = _export_task_log; | |
122 if (_export_task_log) { | 119 if (_export_task_log) { |
123 TaskLog *tasklog = new TaskLog(); | 120 tasklog = new TaskLog(); |
124 tasklog->set_cmd(cmd); | 121 tasklog->set_cmd(cmd); |
125 taskLogQueue->addLast(tasklog); | 122 taskLogQueue->addLast(tasklog); |
126 new_task->tasklog = tasklog; | |
127 } | 123 } |
128 | 124 |
129 return new_task; | 125 return new_task; |
130 } | 126 } |
131 | 127 |
202 * master->wait_for(slave); | 198 * master->wait_for(slave); |
203 */ | 199 */ |
204 void | 200 void |
205 TaskManagerImpl::set_task_depend(HTaskPtr master, HTaskPtr slave) | 201 TaskManagerImpl::set_task_depend(HTaskPtr master, HTaskPtr slave) |
206 { | 202 { |
203 if (_export_task_log) { | |
204 waitTask* wait_task = new waitTask; | |
205 wait_task->task_id = tasklog->mtask_id; | |
206 wait_task->cmd = tasklog->cmd; | |
207 tasklog->wait_for_list.addLast(wait_task); | |
208 } | |
209 | |
207 TaskQueuePtr m, s; | 210 TaskQueuePtr m, s; |
208 if (!master->self) return; | 211 if (!master->self) return; |
209 | 212 |
210 m = taskQueueImpl->create(); m->init(master); | 213 m = taskQueueImpl->create(); m->init(master); |
211 s = taskQueueImpl->create(); s->init(slave); | 214 s = taskQueueImpl->create(); s->init(slave); |
221 * task->spawn(); | 224 * task->spawn(); |
222 */ | 225 */ |
223 void | 226 void |
224 TaskManagerImpl::spawn_task(HTaskPtr task) | 227 TaskManagerImpl::spawn_task(HTaskPtr task) |
225 { | 228 { |
229 if (_export_task_log) | |
230 tasklog->create_time = rdtsc(); | |
226 // waiter // master | 231 // waiter // master |
227 // waitee // slave | 232 // waitee // slave |
228 if (task->wait_i->empty()) { | 233 if (task->wait_i->empty()) { |
229 append_activeTask(task); | 234 append_activeTask(task); |
230 } else { | 235 } else { |
282 */ | 287 */ |
283 void | 288 void |
284 TaskManagerImpl::check_task_finish(HTaskPtr me, QueueInfo<HTask> *wait_queue) | 289 TaskManagerImpl::check_task_finish(HTaskPtr me, QueueInfo<HTask> *wait_queue) |
285 { | 290 { |
286 if (_export_task_log) | 291 if (_export_task_log) |
287 me->tasklog->finish_time = rdtsc(); | 292 tasklog->finish_time = rdtsc(); |
288 | 293 |
289 while(TaskQueue *p = me->wait_me->poll()) { | 294 while(TaskQueue *p = me->wait_me->poll()) { |
290 HTaskPtr you = p->task; | 295 HTaskPtr you = p->task; |
291 QueueInfo<TaskQueue> *wait_i = you->wait_i; | 296 QueueInfo<TaskQueue> *wait_i = you->wait_i; |
292 // 相手の wait queue から自分(を指しているTaskQueue)を削除 | 297 // 相手の wait queue から自分(を指しているTaskQueue)を削除 |
350 */ | 355 */ |
351 void | 356 void |
352 TaskManagerImpl::set_taskList(HTaskPtr htask, QueueInfo<TaskList> * taskList) | 357 TaskManagerImpl::set_taskList(HTaskPtr htask, QueueInfo<TaskList> * taskList) |
353 { | 358 { |
354 if (_export_task_log) | 359 if (_export_task_log) |
355 htask->tasklog->execute_time = rdtsc(); | 360 tasklog->execute_time = rdtsc(); |
356 | 361 |
357 TaskListPtr tl = (TaskList*)htask->rbuf; | 362 TaskListPtr tl = (TaskList*)htask->rbuf; |
358 while(tl->prev) tl=tl->prev; | 363 while(tl->prev) tl=tl->prev; |
359 while(tl) { | 364 while(tl) { |
360 TaskListPtr next = tl->next; | 365 TaskListPtr next = tl->next; |