# HG changeset patch # User Masataka Kohagura # Date 1384937889 -32400 # Node ID efbb42f8077a9317f8a3d8dbf16a819f4c436228 # Parent f2f69b73afe9774700ac83bcf5fc04ff7b20f9fe allocate local variable diff -r f2f69b73afe9 -r efbb42f8077a example/regex_mas/WordCount.h --- a/example/regex_mas/WordCount.h Mon Nov 18 18:15:04 2013 +0900 +++ b/example/regex_mas/WordCount.h Wed Nov 20 17:58:09 2013 +0900 @@ -15,6 +15,7 @@ int file_size; unsigned char *search_word; int search_word_len; + int extra_len; HTaskPtr t_print; } WordCount; diff -r f2f69b73afe9 -r efbb42f8077a example/regex_mas/main.cc --- a/example/regex_mas/main.cc Mon Nov 18 18:15:04 2013 +0900 +++ b/example/regex_mas/main.cc Wed Nov 20 17:58:09 2013 +0900 @@ -90,6 +90,8 @@ run_tasks(SchedTask *manager, WordCount *w, int task_count, HTaskPtr t_next, int size) { + w->extra_len = w->search_word_len - 1; + if (task_count < array_task_num) { array_task_num = task_count; if (task_count<=0) return; @@ -125,20 +127,15 @@ if (w->size < size) size = w->size; - int set_one_task_length = size/sizeof(char); - //const int ONE_TASK_LENGTH = w->division_size; - //const int ONE_LOOP_LENGTH = array_task_num*spe_num*ONE_TASK_LENGTH; - //const int ARRAY_LENGTH_SIZE = spe_num * ONE_TASK_LENGTH; - //int offset = ONE_LOOP_LENGTH * i + ARRAY_LENGTH_SIZE*j + ONE_TASK_LENGTH*k; t_exec[k] = task_array[k]->next_task_array(TASK_EXEC,t_exec[k]); if(size != w->size){ //最後のタスクかどうかの判定 - t_exec[k]->set_param(0,&set_one_task_length + EXTRA_LENGTH); - t_exec[k]->set_inData(0,w->file_mmap + a*w->division_size, size+EXTRA_LENGTH); + t_exec[k]->set_param(0,&w->division_size + w->extra_len); + t_exec[k]->set_inData(0,w->file_mmap + a*w->division_size, w->division_size + w->extra_len); t_exec[k]->set_inData(1,w->search_word, w->search_word_len); }else{ - t_exec[k]->set_param(0,&set_one_task_length); - t_exec[k]->set_inData(0,w->file_mmap + a*w->division_size, size); + t_exec[k]->set_param(0,&w->division_size); + t_exec[k]->set_inData(0,w->file_mmap + a*w->division_size, w->division_size); t_exec[k]->set_inData(1,w->search_word, w->search_word_len); }