Mercurial > hg > Game > Cerium
changeset 775:6074168273de draft
merge
author | Shinji KONO <kono@ie.u-ryukyu.ac.jp> |
---|---|
date | Tue, 12 Jan 2010 10:29:20 +0900 |
parents | 9cbfd2bb5377 (current diff) 55ccf5f6d9af (diff) |
children | 558c6c856f89 |
files | |
diffstat | 5 files changed, 35 insertions(+), 26 deletions(-) [+] |
line wrap: on
line diff
--- a/TaskManager/Makefile.def Mon Jan 11 00:45:20 2010 +0900 +++ b/TaskManager/Makefile.def Tue Jan 12 10:29:20 2010 +0900 @@ -30,7 +30,7 @@ ABIBIT = 32 -# OPT = -O9 +OPT = -O9 OPT = -g CC = g++
--- a/TaskManager/kernel/schedule/SchedTask.cc Mon Jan 11 00:45:20 2010 +0900 +++ b/TaskManager/kernel/schedule/SchedTask.cc Tue Jan 12 10:29:20 2010 +0900 @@ -298,7 +298,7 @@ { va_list ap; va_start(ap,format); - int ret= scheduler->vprintf(format, ap); + int ret= scheduler->vprintf0(format, ap); va_end(ap); return ret; }
--- a/TaskManager/kernel/schedule/Scheduler.cc Mon Jan 11 00:45:20 2010 +0900 +++ b/TaskManager/kernel/schedule/Scheduler.cc Tue Jan 12 10:29:20 2010 +0900 @@ -440,7 +440,7 @@ #if !defined(__SPU__) va_list ap; va_start(ap,format); - int ret= vprintf(format, ap); + int ret= vprintf0(format, ap); va_end(ap); return ret; #else @@ -450,7 +450,7 @@ int -Scheduler::vprintf(const char * format, va_list ap) +Scheduler::vprintf0(const char * format, va_list ap) { #if !defined(__SPU__) int ret= vprintf(format, ap);
--- a/TaskManager/kernel/schedule/Scheduler.h Mon Jan 11 00:45:20 2010 +0900 +++ b/TaskManager/kernel/schedule/Scheduler.h Tue Jan 12 10:29:20 2010 +0900 @@ -138,7 +138,7 @@ long get_random() ; Scheduler *get_scheduler() { return this; }; int printf(const char *format, ...); - int vprintf(const char *format, va_list ap); + int vprintf0(const char *format, va_list ap); };
--- a/example/word_count/main.cc Mon Jan 11 00:45:20 2010 +0900 +++ b/example/word_count/main.cc Tue Jan 12 10:29:20 2010 +0900 @@ -120,33 +120,42 @@ /*渡すデータの最後が文字かどうか。(スペース、改行以外)*/ int word_flag = 0; int i; - for (i = 0; i < task_num; i++) { + int task_size = 32; + for (i = 0; i < task_num; i+=task_size) { + HTask *task_main = manager->create_task_array(TASK_EXEC,task_size,2,1,1); + int j ; + Task *t_exec = 0; + for(j = 0; j < task_size; j++) { + t_exec = task_main->next_task_array(TASK_EXEC,t_exec); + task_main->set_cpu(SPE_ANY); + t_print->wait_for(task_main); + + // t_exec = manager->create_task(TASK_EXEC); + t_exec->set_param(0,division_size); + t_exec->set_param(1,word_flag); + t_exec->set_inData(0,file_mmap + i*division_size, division_size); + t_exec->set_outData(0,o_data + i*status_num, division_out_size); + + word_flag = ((file_mmap[(i+1)*division_size-1] != 0x20) && (file_mmap[(i+1)*division_size-1] != 0x0A)); + + size -= division_size; + } + task_main->spawn_task_array(t_exec->next()); + + } + + while (size>0) { t_exec = manager->create_task(TASK_EXEC); - t_exec->add_inData(file_mmap + i*division_size, division_size); - t_exec->add_outData(o_data + i*status_num, division_out_size); - t_exec->add_param(division_size); - t_exec->add_param(word_flag); + t_exec->set_param(0,size); + t_exec->set_param(1,word_flag); + t_exec->set_inData(0,file_mmap + i*division_size, size); + t_exec->set_outData(0,o_data + i*status_num, division_out_size); t_exec->set_cpu(SPE_ANY); t_print->wait_for(t_exec); t_exec->spawn(); - - word_flag = ((file_mmap[(i+1)*division_size-1] != 0x20) && (file_mmap[(i+1)*division_size-1] != 0x0A)); - + i++; size -= division_size; - - } - - if (size) { - - t_exec = manager->create_task(TASK_EXEC); - t_exec->add_inData(file_mmap + i*division_size, size); - t_exec->add_outData(o_data + i*status_num, division_out_size); - t_exec->add_param(size); - t_exec->add_param(word_flag); - t_exec->set_cpu(SPE_ANY); - t_print->wait_for(t_exec); - t_exec->spawn(); }