Mercurial > hg > Game > Cerium
changeset 1791:2cf6b9020b06 draft
minor fix
author | Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp> |
---|---|
date | Wed, 04 Dec 2013 14:13:48 +0900 |
parents | 6790d1d83bb7 |
children | f93f05ecd5c8 |
files | example/string_args/main.cc example/string_args/ppe/Exec.cc |
diffstat | 2 files changed, 19 insertions(+), 11 deletions(-) [+] |
line wrap: on
line diff
--- a/example/string_args/main.cc Tue Dec 03 22:00:56 2013 +0900 +++ b/example/string_args/main.cc Wed Dec 04 14:13:48 2013 +0900 @@ -1,4 +1,6 @@ -#include <stdio.h> #include <stdlib.h> #include <string.h> +#include <stdio.h> +#include <stdlib.h> +#include <string.h> #include <sys/stat.h> #include <sys/time.h> #include "TaskManager.h" @@ -41,16 +43,18 @@ run_start(TaskManager *manager,char *search_word,int search_word_len) { HTask *exec; + int intTable[5] = { 1, 10, 30, 50, 80}; for(int i = 0; i < task_num; i++){ //ファイルディスクリプタをそのままタスクに渡してあげる exec = manager->create_task(TASK_EXEC); exec->set_cpu(spe_cpu); exec->set_inData(0,search_word,search_word_len); - exec->set_inData(1,search_word,search_word_len); - exec->set_inData(2,intTable,5); - exec->set_param(0,(unsigned long long)one_task_size); //1つのタスクが読み込む量 - exec->spawn(); //タスク数分イテレートする + exec->set_inData(1,intTable,5); + + exec->set_param(0,(long)one_task_size); + exec->set_param(1,(long)i); + exec->spawn(); } }
--- a/example/string_args/ppe/Exec.cc Tue Dec 03 22:00:56 2013 +0900 +++ b/example/string_args/ppe/Exec.cc Wed Dec 04 14:13:48 2013 +0900 @@ -18,17 +18,21 @@ static int run(SchedTask *s, void *rbuf, void *wbuf) { - const char *search_word1 = (char *)s->get_input(rbuf,0); - const char *search_word2 = (char *)s->get_input(rbuf,1); - const int *table = (int *)s->get_input(rbuf,2); + const char *search_word = (char *)s->get_input(rbuf,0); + const int *table = (int *)s->get_input(rbuf,1); long task_size = (long)s->get_param(0); + long task_number = (long)s->get_param(1); //s->xはiteraterで繰り返した数 - s->printf("test num : %d\n",task_size); - s->printf("arg1 word : %s\n",search_word1); - s->printf("arg2 word : %s\n",search_word2); + s->printf("[task number: %d]\n",task_number); + s->printf("num : %d\n",task_size); + s->printf("arg1 word : %s\n",search_word); + + for(int i = 0; i < 5; i++){ + if(table[i] == 100) break; + } return 0; }