Mercurial > hg > Game > Cerium
changeset 220:305ac1897c50 draft
fix
author | gongo@localhost.localdomain |
---|---|
date | Mon, 09 Feb 2009 21:58:45 +0900 |
parents | 335ea3665fcd |
children | 0b0e0f323742 |
files | TaskManager/Cell/spe/SchedTask.cc TaskManager/Test/test_render/Makefile.def TaskManager/Test/test_render/sys.cpp TaskManager/kernel/ppe/TaskManager.cc TaskManager/kernel/ppe/TaskManagerImpl.cc TaskManager/kernel/schedule/SchedTask.cc example/many_task/Func.h example/many_task/Makefile.ps3 example/many_task/main.cc example/many_task/ppe/QuickSort.cc example/many_task/ppe/QuickSort.h example/many_task/ppe/RunFinish.cc example/many_task/ppe/RunFinish.h example/many_task/ppe/RunStart.cc example/many_task/ppe/RunStart.h example/many_task/ppe/mymethod.cc example/many_task/spe/Makefile example/many_task/spe/QuickSort.cc example/many_task/spe/QuickSort.h example/many_task/task_init.cc include/TaskManager/TaskManager.h |
diffstat | 21 files changed, 178 insertions(+), 309 deletions(-) [+] |
line wrap: on
line diff
--- a/TaskManager/Cell/spe/SchedTask.cc Mon Feb 09 00:12:40 2009 +0900 +++ b/TaskManager/Cell/spe/SchedTask.cc Mon Feb 09 21:58:45 2009 +0900 @@ -47,8 +47,7 @@ */ SchedTask::~SchedTask(void) { - __scheduler->dma_wait(DMA_WRITE); - free(__writebuf); + //printf("%p\n", this); if (__flag_renewTask == SCHED_TASK_RENEW) { free(__inListData); @@ -76,11 +75,11 @@ { __flag_renewTask = SCHED_TASK_RENEW; - ex_init = &SchedTask::ex_init_renew; - ex_read = &SchedTask::ex_read_renew; - ex_exec = &SchedTask::ex_exec_renew; - ex_write = &SchedTask::ex_write_renew; - ex_next = &SchedTask::ex_next_renew; + ex_init = &SchedTask::ex_init_renew; + ex_read = &SchedTask::ex_read_renew; + ex_exec = &SchedTask::ex_exec_renew; + ex_write = &SchedTask::ex_write_renew; + ex_next = &SchedTask::ex_next_renew; } void @@ -185,6 +184,12 @@ __taskGroup = NULL; } + + // 書き込む領域がなければ無視 + if (__outListData->size > 0 || __outListData->length > 0) { + __scheduler->dma_storeList(__outListData, __writebuf, DMA_WRITE); + } + (this->*ex_exec)(); } @@ -193,18 +198,9 @@ { __debug("[SchedTask:%s]\n", __FUNCTION__); - - // 書き込む領域がなければ無視 - if (__outListData->size > 0 || __outListData->length > 0) { - __scheduler->dma_storeList(__outListData, __writebuf, DMA_WRITE); - } + __scheduler->dma_wait(DMA_WRITE); + free(__writebuf); - /** - * このタスクはSPE内で生成されたが、 - * このタスクの終了を待つ必要はない、という設定がされているため、 - * (wait_task() が呼ばれていない) - * ここで終了する。ex_write は実行しない - */ if (__task->self == MY_SPE_NOP) return; (this->*ex_write)();
--- a/TaskManager/Test/test_render/Makefile.def Mon Feb 09 00:12:40 2009 +0900 +++ b/TaskManager/Test/test_render/Makefile.def Mon Feb 09 21:58:45 2009 +0900 @@ -3,10 +3,10 @@ # include/library path # ex: macosx #CERIUM = /Users/gongo/Source/Concurrency/Game_project/Cerium -CERIUM = /Users/gongo/Source/hg/Cerium +#CERIUM = /Users/gongo/Source/hg/Cerium # ex: linux/ps3 -#CERIUM = /home/gongo/Cerium +CERIUM = /home/gongo/Cerium #CERIUM = /Users/tkaito/hg/Game/Cerium #CERIUM = ../../..
--- a/TaskManager/Test/test_render/sys.cpp Mon Feb 09 00:12:40 2009 +0900 +++ b/TaskManager/Test/test_render/sys.cpp Mon Feb 09 21:58:45 2009 +0900 @@ -1,5 +1,6 @@ #include <stdlib.h> #include <iostream> +#include <string.h> #include <math.h> #include "sys.h" using namespace std;
--- a/TaskManager/kernel/ppe/TaskManager.cc Mon Feb 09 00:12:40 2009 +0900 +++ b/TaskManager/kernel/ppe/TaskManager.cc Mon Feb 09 21:58:45 2009 +0900 @@ -69,3 +69,9 @@ TaskManager::allocate(int size) { return m_impl->allocate(size); } + +int +TaskManager::get_cpuNum(void) +{ + return machineNum; +}
--- a/TaskManager/kernel/ppe/TaskManagerImpl.cc Mon Feb 09 00:12:40 2009 +0900 +++ b/TaskManager/kernel/ppe/TaskManagerImpl.cc Mon Feb 09 21:58:45 2009 +0900 @@ -4,7 +4,7 @@ #include "error.h" #include "../sys_task/SysTask.h" -//static HTaskPtr systask_start; +static HTaskPtr systask_start; static HTaskPtr systask_finish; void @@ -15,12 +15,25 @@ TaskManagerImpl::TaskManagerImpl(int num) : machineNum(num), activeTaskQueue(NULL), waitTaskQueue(NULL) {} +/** + * 一番最初に PPE で実行される systask_start + * 一番最後に、全てのタスクの終了を待つ systask_finish + * 番兵的な意味で実装 + */ void TaskManagerImpl::systask_init(void) { systask_register(); + systask_start = create_task(SYSTASK_START); systask_finish = create_task(SYSTASK_FINISH); + + systask_start->spawn(); + + // systask_finish で spawn すると + // systask_finish->wait_for(systask_finish); + // とかなって無限ループになるので、 + // これだけは明示的に append_waitTask() で append_waitTask(systask_finish); }
--- a/TaskManager/kernel/schedule/SchedTask.cc Mon Feb 09 00:12:40 2009 +0900 +++ b/TaskManager/kernel/schedule/SchedTask.cc Mon Feb 09 21:58:45 2009 +0900 @@ -34,15 +34,20 @@ ex_exec = &SchedTask::ex_exec_normal; ex_write = &SchedTask::ex_write_normal; ex_next = &SchedTask::ex_next_normal; + + run_func = &SchedTask::run; } +/** + * dma_store の wait を行う + * このタスクが RenewTask だった場合、 + * __inListData や __outListData は + * Scheduler の持つ、使い回しの buffer ではなく + * 新たに allocate されたものなので、ここで free する + */ SchedTask::~SchedTask(void) { if (__flag_renewTask == SCHED_TASK_RENEW) { - /** - * __inListData と __outListData はタスク自身のものなので - * 終わったら即 free する。 - */ free(__inListData); free(__outListData); @@ -166,8 +171,9 @@ __scheduler->dma_wait(DMA_READ); - run(__readbuf, __writebuf); + //run(__readbuf, __writebuf); + (this->*run_func)(__readbuf, __writebuf); free(__readbuf); if (__taskGroup->status() != 0) { @@ -176,15 +182,6 @@ __taskGroup = NULL; } - // 書き込む領域が要らなければ無視 - if (__outListData->size > 0 || __outListData->length > 0) { - __scheduler->dma_storeList(__outListData, __writebuf, DMA_WRITE); - // SchedTask::write(void) でも wait 掛けてるんだけど、 - // 実際にはここに wait しないとちゃんと書き込まれてない感じがする - // wait はされてるはずなんだがなー - __scheduler->dma_wait(DMA_WRITE); - } - (this->*ex_exec)(); } @@ -193,18 +190,11 @@ { __debug("[SchedTask:%s]\n", __FUNCTION__); - __scheduler->dma_wait(DMA_WRITE); - free(__writebuf); - /** - * このタスクはSPE内で生成されたが、 - * このタスクの終了を待つ必要はない、という設定がされているため、 - * (wait_task() が呼ばれていない) - * ここで終了する。ex_write は実行しない - */ - if (__task->self == MY_SPE_NOP) return; - - (this->*ex_write)(); + // 書き込む領域がなければ無視 + if (__outListData->size > 0 || __outListData->length > 0) { + __scheduler->dma_storeList(__outListData, __writebuf, DMA_WRITE); + } } /** @@ -292,6 +282,11 @@ { __debug("[SchedTask:%s]\n", __FUNCTION__); + __scheduler->dma_wait(DMA_WRITE); + free(__writebuf); + + (this->*ex_write)(); + delete p; return (this->*ex_next)();
--- a/example/many_task/Func.h Mon Feb 09 00:12:40 2009 +0900 +++ b/example/many_task/Func.h Mon Feb 09 21:58:45 2009 +0900 @@ -1,22 +1,3 @@ -#define NUM_ITEM 12000 -#define EXE_NUM 6 -#define TASK_NUM 6 -#define HTASK_NUM 5 - enum { - HELLO_TASK, - TASK_MAIN, - TASK_FINISH, - QUICK_SORT, + QUICK_SORT, }; - -// array position -typedef struct Data { - int index; - int ptr; -} Data; - -//extern function -extern void init_data ( Data *data , int size); -extern void show_data( Data *data, int size ); -extern void write_data( Data *data, int size);
--- a/example/many_task/Makefile.ps3 Mon Feb 09 00:12:40 2009 +0900 +++ b/example/many_task/Makefile.ps3 Mon Feb 09 21:58:45 2009 +0900 @@ -12,7 +12,7 @@ TASK_OBJS = $(TASK_SRCS:.cc=.o) CC = g++ -CFLAGS = -g -Wall# -O9 #-DDEBUG +CFLAGS = -g -Wall -O9 #-DDEBUG INCLUDE = -I${CERIUM}/include/TaskManager -I. -I.. LIBS = -L${CERIUM}/TaskManager -lCellManager -lspe2 -lpthread
--- a/example/many_task/main.cc Mon Feb 09 00:12:40 2009 +0900 +++ b/example/many_task/main.cc Mon Feb 09 21:58:45 2009 +0900 @@ -4,12 +4,49 @@ #include <sys/time.h> #include "TaskManager.h" #include "Func.h" +#include "sort.h" +#include "prof.h" + +//#define DEBUG_CHECK extern void task_init(void); -int data_size = 1200; - -double getTime(); +// sort.cc +extern int data_length; +extern DataPtr data; + +// 荐羝 +static double st_time; +static double ed_time; + +static int length = 1200; + +// prototype +void TMend(void); + +static double +getTime(void) +{ + struct timeval tv; + gettimeofday(&tv, NULL); + return tv.tv_sec + (double)tv.tv_usec*1e-6; +} + +static void +show_data(void) +{ +#if defined(DEBUG_CHECK) + for(int i = 0; i < data_length; i++) { + printf("%d\n", data[i].index); + } +#else + puts("-----------------------------------------------"); + for(int i = 0; i < data_length; i++) { + printf("data[%02d].index = %d\n", i, data[i].index); + } + puts("-----------------------------------------------"); +#endif +} const char *help_str = "Usage: ./sort [option]\n \ options\n\ @@ -22,7 +59,7 @@ { for (int i = 1; argv[i]; ++i) { if (strcmp(argv[i], "--length") == 0 || strcmp(argv[i], "-l") == 0) { - data_size = atoi(argv[++i]); + length = atoi(argv[++i]); } if (strcmp(argv[i], "--help") == 0 || strcmp(argv[i], "-h") == 0) { printf("%s\n", help_str); @@ -33,40 +70,45 @@ return 0; } +extern void sort_init(int, int); + +unsigned int ts, te; + int -cerium_main(int argc, char *argv[]) +TMmain(int argc, char *argv[]) { - // 荐羝 - double st_time, ed_time; - HTask *runLoop; - if (init(argc, argv) < 0) { return -1; } task_init(); - runLoop = manager->create_task(TASK_MAIN); - runLoop->add_param(6); - runLoop->add_param(data_size); + sort_init(manager->get_cpuNum(), length); - runLoop->spawn(); - // Start st_time = getTime(); - //manager->run(); - //ed_time = getTime(); + //StartProf(ts); - //printf("Time: %0.6f\n",ed_time-st_time); + manager->set_TMend(TMend); - //delete manager; -FINISH: return 0; } -double getTime() +void +TMend(void) { - struct timeval tv; - gettimeofday(&tv, NULL); - return tv.tv_sec + (double)tv.tv_usec*1e-6; + ed_time = getTime(); + //show_data(); +#if !defined(DEBUG_CHECK) + //StopProf(te, ts); + + //unsigned tmps, tmpe; + + // profile 潟鴻荐膊 + //StartProf(tmps); + //StopProf(tmpe, tmps); + + //PrintProf((te - tmpe)); + printf("Time: %0.6f\n",ed_time-st_time); +#endif }
--- a/example/many_task/ppe/QuickSort.cc Mon Feb 09 00:12:40 2009 +0900 +++ b/example/many_task/ppe/QuickSort.cc Mon Feb 09 21:58:45 2009 +0900 @@ -1,4 +1,3 @@ -#include "Func.h" #include "QuickSort.h" #include <stdio.h> #include <string.h> @@ -10,6 +9,7 @@ // copy value int begin = 0; int end = get_param(0); + Data *r_data = (Data*)get_input(rbuff, 0); Data *w_data = (Data*)get_output(wbuff, 0);
--- a/example/many_task/ppe/QuickSort.h Mon Feb 09 00:12:40 2009 +0900 +++ b/example/many_task/ppe/QuickSort.h Mon Feb 09 21:58:45 2009 +0900 @@ -5,13 +5,15 @@ # include "SchedTask.h" #endif +#include "sort.h" + class QuickSort : public SchedTask { public: SchedConstructor(QuickSort); int run(void *r, void *w); - void quick_sort( Data *data, int left, int right); - void swap( Data *data, int left, int right ); + void quick_sort(Data *data, int left, int right); + void swap(Data *data, int left, int right ); }; #endif
--- a/example/many_task/ppe/RunFinish.cc Mon Feb 09 00:12:40 2009 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,18 +0,0 @@ -#include "TaskManager.h" -#include "RunFinish.h" -#include "Func.h" - -SchedDefineTask(RunFinish); - -int -RunFinish::run(void* rbuff, void* wbuff) -{ - //Data *data = get_inListElementPtr(rbuff,0,Data*); - //int size = get_inListElement(rbuff,1,int); - Data *data = (Data*)get_input(rbuff, 0); - int size = get_param(0); - - show_data(data,size); - - return 0; -}
--- a/example/many_task/ppe/RunFinish.h Mon Feb 09 00:12:40 2009 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,15 +0,0 @@ -#ifndef INCLUDED_TASK_FINISH -#define INCLUDED_TASK_FINISH - -#ifndef INCLUDED_SCHED_TASK -# include "SchedTask.h" -#endif - -class RunFinish : public SchedTask { -public: - SchedConstructor(RunFinish); - - int run(void *readbuf, void *writebuf); -}; - -#endif
--- a/example/many_task/ppe/RunStart.cc Mon Feb 09 00:12:40 2009 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,131 +0,0 @@ -#include <stdio.h> -#include <stdlib.h> -#include "TaskManager.h" -#include "RunStart.h" -#include "Func.h" - -#define MAXSIZE 1024*16/8 - -extern TaskManager *manager; - -SchedDefineTask(RunStart); - -int length; -int block_size; -int half_size; -int last_len; - -int RunStart::run(void* rbuff, void* wbuff) -{ - int spe_num = get_param(0); - int length = get_param(1); - - // 16с≪ゃ<潟 - Data *data = (Data*)manager->malloc( sizeof(Data)*length ); - init_data( data, length ); - - // 篆<с鐚若帥泣ゃ冴茯炊眼 - int task_num = set_block_num(length,spe_num); - int exe_num = task_num; - int htask_num = task_num-1; - - // TASK_NUM 6 HTASK 5 - HTaskPtr f_sort_task[exe_num][task_num]; - HTaskPtr b_sort_task[exe_num][htask_num]; - - // ≪ゃ<潟16茯炊 - block_size = length/task_num; - if(block_size%2 != 0) block_size++; - - // ≪ゃ<潟16茯炊 - half_size = block_size/2; - if(half_size%2 != 0) half_size++; - // 緇泣ゃ冴茯炊 - last_len = length - (task_num-1)*block_size; - - printf("spe_num:%d ,length:%d\n",spe_num,length); - printf("length:%d, block_size:%d, last_len:%d,half_len:%d\n",length,block_size, last_len,half_size); - - for (int exe=0; exe<exe_num; exe++) { - - for(int i=0; i<task_num-1; i++) { - //f_sort_task[exe][i] = manager->create_task(QUICK_SORT, 0); - f_sort_task[exe][i] = manager->create_task(QUICK_SORT); - f_sort_task[exe][i]->add_inData(&data[i*block_size], sizeof(Data)*block_size); - //f_sort_task[exe][i]->add_inData(block_size, 0); - f_sort_task[exe][i]->add_param(block_size); - f_sort_task[exe][i]->add_outData(&data[i*block_size], sizeof(Data)*block_size); - //f_sort_task[exe][i]->set_cpu((CPU_TYPE)(SPE_0+(i%spe_num))); - f_sort_task[exe][i]->set_cpu(SPE_ANY); - } - - //f_sort_task[exe][task_num-1] = manager->create_task(QUICK_SORT, 0); - f_sort_task[exe][task_num-1] = manager->create_task(QUICK_SORT); - f_sort_task[exe][task_num-1]->add_inData(&data[(task_num-1)*block_size], sizeof(Data)*last_len); - //f_sort_task[exe][task_num-1]->add_inData(last_len, 0); - f_sort_task[exe][task_num-1]->add_param(last_len); - f_sort_task[exe][task_num-1]->add_outData(&data[(task_num-1)*block_size], sizeof(Data)*last_len); - //f_sort_task[exe][task_num-1]->set_cpu((CPU_TYPE)(SPE_0+(task_num-1)%spe_num)); - f_sort_task[exe][task_num-1]->set_cpu(SPE_ANY); - - for(int i=0; i<htask_num; i++) { - //b_sort_task[exe][i] = manager->create_task(QUICK_SORT, 0); - b_sort_task[exe][i] = manager->create_task(QUICK_SORT); - b_sort_task[exe][i]->add_inData(&data[i*block_size+half_size], sizeof(Data)*block_size); - //b_sort_task[exe][i]->add_inData(block_size, 0); - b_sort_task[exe][i]->add_param(block_size); - b_sort_task[exe][i]->add_outData(&data[i*block_size+half_size], sizeof(Data)*block_size); - //b_sort_task[exe][i]->set_cpu((CPU_TYPE)(SPE_0+(i%spe_num))); - b_sort_task[exe][i]->set_cpu(SPE_ANY); - b_sort_task[exe][i]->wait_for(f_sort_task[exe][i]); - b_sort_task[exe][i]->wait_for(f_sort_task[exe][i+1]); - } - } - - for (int exe=1; exe<exe_num; exe++) { - for(int i=0; i<task_num; i++) { - if (i==0) { - f_sort_task[exe][i]->wait_for(b_sort_task[exe-1][i]); - } else if (i==task_num-1) { - f_sort_task[exe][i]->wait_for(b_sort_task[exe-1][i-1]); - } else { - f_sort_task[exe][i]->wait_for(b_sort_task[exe-1][i]); - f_sort_task[exe][i]->wait_for(b_sort_task[exe-1][i-1]); - } - } - } - - HTaskPtr task_finish; - //task_finish = manager->create_task(TASK_FINISH, 0); - task_finish = manager->create_task(TASK_FINISH); - task_finish->add_inData(data, sizeof(Data)*length); - //task_finish->add_inData(&length, sizeof(int)); - task_finish->add_param(length); - for(int i=0; i<htask_num; i++) task_finish->wait_for( b_sort_task[exe_num-1][i] ); - - task_finish->spawn(); - - for (int exe=0; exe<exe_num; exe++) { - for(int i=0; i<htask_num; i++) b_sort_task[exe][i]->spawn(); - for(int i=0; i<task_num; i++) f_sort_task[exe][i]->spawn(); - } - - return 0; -} - -int -RunStart::set_block_num(int length, int block_num) -{ -#if 0 - if (length/block_num > MAXSIZE) { - block_num++; - block_num = set_block_num(length, block_num); - } -#else - while (length/block_num > MAXSIZE) { - block_num++; - } -#endif - return block_num; -} -
--- a/example/many_task/ppe/RunStart.h Mon Feb 09 00:12:40 2009 +0900 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,15 +0,0 @@ -#ifndef INCLUDED_TASK_START -#define INCLUDED_TASK_START - -#ifndef INCLUDED_SCHED_TASK -# include "SchedTask.h" -#endif - -class RunStart : public SchedTask { -public: - SchedConstructor(RunStart); - int run(void *readbuf, void *writebuf); - int set_block_num(int length, int block_num); -}; - -#endif
--- a/example/many_task/ppe/mymethod.cc Mon Feb 09 00:12:40 2009 +0900 +++ b/example/many_task/ppe/mymethod.cc Mon Feb 09 21:58:45 2009 +0900 @@ -1,3 +1,4 @@ +#include "sort.h" #include "TaskManager.h" #include "Func.h" #include <stdlib.h>
--- a/example/many_task/spe/Makefile Mon Feb 09 00:12:40 2009 +0900 +++ b/example/many_task/spe/Makefile Mon Feb 09 21:58:45 2009 +0900 @@ -7,7 +7,7 @@ OBJS = $(SRCS:.cc=.o) CC = spu-g++ -CFLAGS = -g -Wall -fno-exceptions -fno-rtti #-DDEBUG +CFLAGS = -O9 -g -Wall -fno-exceptions -fno-rtti #-DDEBUG INCLUDE = -I${CERIUM}/include/TaskManager -I. -I.. LIBS = -L${CERIUM}/TaskManager -lspemanager
--- a/example/many_task/spe/QuickSort.cc Mon Feb 09 00:12:40 2009 +0900 +++ b/example/many_task/spe/QuickSort.cc Mon Feb 09 21:58:45 2009 +0900 @@ -1,40 +1,67 @@ -#include "Func.h" #include "QuickSort.h" #include <stdio.h> #include <string.h> SchedDefineTask(QuickSort); +static void +check_data(DataPtr data, int length) +{ + for (int i = 0; i < length-1; i++) { + if (data[i].index > data[i+1].index) { + printf("error!!\n"); + } else { + printf("%d < %d\n", data[i].index, data[i+1].index); + } + } +} + int QuickSort::run(void* rbuff, void* wbuff) { - int begin = 0; - int end = get_param(0); - Data *r_data = (Data*)get_input(rbuff, 0); - Data *w_data = (Data*)get_output(wbuff, 0); + int begin = 0; + int end = smanager->get_param(0); + DataPtr r_data = (DataPtr)smanager->get_input(0); + DataPtr w_data = (DataPtr)smanager->get_output(0); - //printf("--\n[SPE] Quick: length:%d addr->%x \n",end, (int*)rbuff); - //printf("[SPE] Quick: data[0]: %d addr->%x\n",sizeof(r_data),r_data); - //show_data(r_data, end); + int real_start = smanager->get_param(1); + quick_sort(r_data, begin, end-1); + //check_data(r_data, end); + //bubble_sort(r_data, begin, end-1); memcpy(w_data, r_data, sizeof(Data)*end); + return 0; } void -QuickSort::quick_sort( Data *data, int begin, int end ) { +QuickSort::bubble_sort(DataPtr data, int begin, int end) +{ + for (int i = 0; i < end; i++) { + for (int j = end; j > i; j--) { + if (data[j].index < data[j-1].index) { + swap(data, j, j-1); + } + } + } +} +void +QuickSort::quick_sort(DataPtr data, int begin, int end) +{ if (begin < end) { + int where = (begin + end) / 2; int pivot = data[where].index; data[where].index = data[begin].index; int p = begin; - int i; - for (i=begin+1; i<=end; i++) { + + for (int i = begin+1; i <= end; i++) { if (data[i].index < pivot) { p++; swap(data, p, i); } } + data[begin].index = data[p].index; data[p].index = pivot; @@ -44,18 +71,9 @@ } void -QuickSort::swap( Data *data, int left, int right ) +QuickSort::swap(Data *data, int left, int right) { - int tmp = data[left].index; + int tmp = data[left].index; data[left].index = data[right].index; data[right].index = tmp; } - -void -show_data( Data *data, int size ) -{ - puts("-----------------------------------------------"); - for(int i=0; i<size; i++) printf("data[%02d].index = %d\n", i, data[i].index); - puts("-----------------------------------------------"); - return; -}
--- a/example/many_task/spe/QuickSort.h Mon Feb 09 00:12:40 2009 +0900 +++ b/example/many_task/spe/QuickSort.h Mon Feb 09 21:58:45 2009 +0900 @@ -5,13 +5,16 @@ # include "SchedTask.h" #endif +#include "sort.h" + class QuickSort : public SchedTask { public: SchedConstructor(QuickSort); int run(void *r, void *w); - void quick_sort( Data *data, int left, int right); - void swap( Data *data, int left, int right ); + void quick_sort(Data *data, int left, int right); + void bubble_sort(Data *data, int left, int right); + void swap(Data *data, int left, int right ); }; #endif
--- a/example/many_task/task_init.cc Mon Feb 09 00:12:40 2009 +0900 +++ b/example/many_task/task_init.cc Mon Feb 09 21:58:45 2009 +0900 @@ -1,20 +1,10 @@ #include "Func.h" #include "Scheduler.h" -//SchedExternTask(Hello); -SchedExternTask(RunStart); -SchedExternTask(RunFinish); SchedExternTask(QuickSort); -/** - * ∽違 ../spe/spe-main c - * у若喝冴違∽違 - * 絅純∽医сk (SchedRegisterTask 綽) - */ + void task_init(void) { -// SchedRegisterTask(HELLO_TASK, Hello); - SchedRegisterTask(TASK_MAIN, RunStart); - SchedRegisterTask(TASK_FINISH, RunFinish); SchedRegisterTask(QUICK_SORT, QuickSort); }
--- a/include/TaskManager/TaskManager.h Mon Feb 09 00:12:40 2009 +0900 +++ b/include/TaskManager/TaskManager.h Mon Feb 09 21:58:45 2009 +0900 @@ -12,7 +12,6 @@ ~TaskManager(void); /* variables */ - TaskManagerImpl *m_impl; void (*tm_end)(void); @@ -21,6 +20,7 @@ void run(void); void *allocate(int size); void set_TMend(void (*endf)(void)); + int get_cpuNum(void); /* functions */ void init(void);