Mercurial > hg > Game > Cerium
changeset 939:aafa99c856a3 draft
loop detection.
author | Shinji KONO <kono@ie.u-ryukyu.ac.jp> |
---|---|
date | Sat, 31 Jul 2010 12:18:19 +0900 |
parents | 20beb83a5a22 |
children | e01b551f25d6 |
files | TaskManager/Cell/CellTaskManagerImpl.cc TaskManager/kernel/ppe/TaskManagerImpl.cc example/many_task/sort.cc |
diffstat | 3 files changed, 38 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/TaskManager/Cell/CellTaskManagerImpl.cc Sat Jul 31 10:32:19 2010 +0900 +++ b/TaskManager/Cell/CellTaskManagerImpl.cc Sat Jul 31 12:18:19 2010 +0900 @@ -152,12 +152,39 @@ } } +static void +loop_check(HTask *p,HTask *me, int depth) +{ + if (p==me) printf("*%lx ",(long)p); // loop + if (depth==0) return; + TaskQueueInfo *w = p->wait_i; + if (w) { + for( TaskQueue *q = w->getFirst(); q; q = w->getNext(q)) { + loop_check(q->task,me, depth-1); + } + } +} + void CellTaskManagerImpl::show_dead_lock_info() { get_scheduler()-> printf("Dead lock detected\n ppe queue %d\n", ppeManager->activeTaskQueue->length()); + // 確か waitQueue は共通... + // get_scheduler()-> printf(" wait queue %d\n",ppeManager->waitTaskQueue->length()); get_scheduler()-> printf(" wait queue %d\n",waitTaskQueue->length()); + for( HTask *p = waitTaskQueue->getFirst(); p; p = waitTaskQueue->getNext(p)) { + printf(" Waiting task%d %lx",p->command, (long)p); + TaskQueueInfo *w = p->wait_i; + if (w) { + for( TaskQueue *q = w->getFirst(); q; q = w->getNext(q)) { + printf(" waiting task%d %lx",q->task->command, (long)q->task); + if (!waitTaskQueue->find(q->task)) printf("!"); // stray task + loop_check(q->task,p, 10); + } + } + printf("\n"); + } get_scheduler()-> printf(" spe queue %d\n",activeTaskQueue->length()); for (int i = 0; i < machineNum; i++) { get_scheduler()-> printf(" spe %d send %d wait %d\n",i,
--- a/TaskManager/kernel/ppe/TaskManagerImpl.cc Sat Jul 31 10:32:19 2010 +0900 +++ b/TaskManager/kernel/ppe/TaskManagerImpl.cc Sat Jul 31 12:18:19 2010 +0900 @@ -156,6 +156,8 @@ void TaskManagerImpl::check_task_finish(HTaskPtr me, HTaskInfo *wait_queue) { + if (me->self == 0) + printf(" wait for zombi! %ld\n",(long)me); while(TaskQueue *p = me->wait_me->poll()) { HTaskPtr you = p->task; @@ -173,6 +175,14 @@ wait_i->free_(p); } + // me を誰かが持っていて、me が finish した後に、 + // me->wait_for(i) とか、やられると気まずい。 + // 特に、me が他人に再利用されていると。そういう時には、 + // このfreeをコメントアウトしてみる。 + + // id かななんかでチェックした方が良いが... + + me->self = 0; htaskImpl->free_(me); }
--- a/example/many_task/sort.cc Sat Jul 31 10:32:19 2010 +0900 +++ b/example/many_task/sort.cc Sat Jul 31 12:18:19 2010 +0900 @@ -52,7 +52,7 @@ static int sort_restart(SchedTask *s, void *d, void *e) { - static int ccc = 0; + // static int ccc = 0; // printf("restarted %d %% %d\n",ccc++,split_num); sort_start(s);