# HG changeset patch # User Shinji KONO # Date 1280930759 -32400 # Node ID 02f1a707ee8228d1950c3fd323532856c1d4ed1b # Parent 6945fb810ce3fe4effeebab9c761bee4a24edb27 fix QueueInfo diff -r 6945fb810ce3 -r 02f1a707ee82 TaskManager/kernel/ppe/QueueInfo.h --- a/TaskManager/kernel/ppe/QueueInfo.h Wed Aug 04 19:08:33 2010 +0900 +++ b/TaskManager/kernel/ppe/QueueInfo.h Wed Aug 04 23:05:59 2010 +0900 @@ -32,6 +32,7 @@ */ QueueInfo(){ queueInfoInit(); + queuePool = this; } /** normal constructor requires @@ -39,7 +40,6 @@ QueueInfo(QueueInfo *p) { queueInfoInit(); queuePool = p; - queuePool->queuePool = queuePool; } BASE_NEW_DELETE(QueueInfo); diff -r 6945fb810ce3 -r 02f1a707ee82 example/task_queue/main.cc --- a/example/task_queue/main.cc Wed Aug 04 19:08:33 2010 +0900 +++ b/example/task_queue/main.cc Wed Aug 04 23:05:59 2010 +0900 @@ -7,12 +7,13 @@ extern void task_init(void); -static int count = 1; +static int count = 10; extern TaskManager *manager; extern void queueInfoTest(int count); +static QueueInfo *mainPool = new QueueInfo() ; const char *usr_help_str = "Usage: ./hello [-cpu spe_num] [-count N]\n\ -cpu Number of SPE (default 1) \n\ @@ -62,7 +63,8 @@ queues.m = manager; queues.i = 0; for (int i = 0; i < MAX_QUEUE; i++) { - TaskQueueInfo *q = new TaskQueueInfo() ; + QueueInfo *q = new QueueInfo(mainPool) ; + // QueueInfo *q = new QueueInfo() ; queues.q[i] = q; } @@ -106,6 +108,7 @@ if (init(argc, argv) < 0) { return -1; } + if (count<2) count = 2; // Task Register // ppe/task_init.cc diff -r 6945fb810ce3 -r 02f1a707ee82 example/task_queue/main.h --- a/example/task_queue/main.h Wed Aug 04 19:08:33 2010 +0900 +++ b/example/task_queue/main.h Wed Aug 04 23:05:59 2010 +0900 @@ -1,4 +1,5 @@ -#include "TaskQueueInfo.h" +#include "TaskQueue.h" +#include "QueueInfo.h" #include "TaskManager.h" #define MAX_QUEUE 4 @@ -7,5 +8,5 @@ int i; int j; TaskManager *m; - TaskQueueInfo *q[MAX_QUEUE]; + QueueInfo *q[MAX_QUEUE]; } Queues, *QueuePtr; diff -r 6945fb810ce3 -r 02f1a707ee82 example/task_queue/ppe/Hello.cc --- a/example/task_queue/ppe/Hello.cc Wed Aug 04 19:08:33 2010 +0900 +++ b/example/task_queue/ppe/Hello.cc Wed Aug 04 23:05:59 2010 +0900 @@ -18,15 +18,15 @@ smanager->printf("[%d] Hello, World!!\n", task_id); for(int i=0;i<100;i++) { - TaskQueueInfo *i0 = q->q[i%MAX_QUEUE]; - TaskQueueInfo *i1 = q->q[(i+1)%MAX_QUEUE]; + QueueInfo *i0 = q->q[i%MAX_QUEUE]; + QueueInfo *i1 = q->q[(i+1)%MAX_QUEUE]; TaskQueue *q0; TaskQueue *q1; switch(q->m->get_random() % 4) { case 0: - q0 = i0->create(0); - q1 = i1->create(0); + q0 = i0->create(); i0->init(0); + q1 = i1->create(); i1->init(0); i1->addLast(q0); i0->addLast(q1); break; diff -r 6945fb810ce3 -r 02f1a707ee82 example/task_queue/testQueueInfo.cc --- a/example/task_queue/testQueueInfo.cc Wed Aug 04 19:08:33 2010 +0900 +++ b/example/task_queue/testQueueInfo.cc Wed Aug 04 23:05:59 2010 +0900 @@ -27,14 +27,14 @@ i = 0; for(TaskListPtr t= q->getFirst(); t ;t = q->getNext(t) ) { - printf(" No. %d %ld\n", i++, t->length); + printf(" No. %d %d\n", i++, t->length); } - printf("First %ld\n", q->getFirst()->length); - printf("Last %ld\n", q->getLast()->length); + printf("First %d\n", q->getFirst()->length); + printf("Last %d\n", q->getLast()->length); TaskListPtr t = q->poll(); - printf("Polled %ld\n", t->length); + printf("Polled %d\n", t->length); q->free_(t); printf("Length %d = %d - 1\n", q->length(), count); @@ -43,7 +43,7 @@ i = 0; for(TaskListPtr t= q->getFirst(); t ;t = q->getNext(t) ) { - printf(" No. %d %ld\n", i++, t->length); + printf(" No. %d %d\n", i++, t->length); } while(!q->empty()){ @@ -52,7 +52,7 @@ i = 0; for(TaskListPtr t= r->getFirst(); t ;t = r->getNext(t) ) { - printf(" No. %d %ld\n", i++, t->length); + printf(" No. %d %d\n", i++, t->length); }