Mercurial > hg > Game > Cerium
changeset 1751:224802aba3bd draft
minor fix
author | Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp> |
---|---|
date | Fri, 22 Nov 2013 02:07:46 +0900 |
parents | 87b2b59161bd |
children | 537707f376c8 11d3bd9d2244 |
files | example/regex_mas/WordCount.h example/regex_mas/main.cc |
diffstat | 2 files changed, 5 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/example/regex_mas/WordCount.h Thu Nov 21 02:57:47 2013 +0900 +++ b/example/regex_mas/WordCount.h Fri Nov 22 02:07:46 2013 +0900 @@ -13,6 +13,7 @@ int out_task_num; char *file_mmap; int file_size; + int last_task_size; unsigned char *search_word; int search_word_len; int extra_len;
--- a/example/regex_mas/main.cc Thu Nov 21 02:57:47 2013 +0900 +++ b/example/regex_mas/main.cc Fri Nov 22 02:07:46 2013 +0900 @@ -41,6 +41,7 @@ int set_param_num = 1; int set_out_num = 1; +static int division = 16; // in Kbyte //static unsigned char* search_word; CPU_TYPE spe_cpu = SPE_ANY; const char *usr_help_str = "Usage: ./word_count [-a -c -s] [-cpu spe_num] [-file filename]\n"; @@ -84,7 +85,7 @@ } /*sizeをページングサイズの倍数にあわせる*/ - st_mmap.size = fix_byte(sb.st_size,4096); + st_mmap.size = fix_byte(sb.st_size,division * 1024); st_mmap.file_mmap = (char*)manager->allocate(st_mmap.size); read(fd,st_mmap.file_mmap,st_mmap.size); @@ -147,7 +148,7 @@ 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,&w->division_size); + t_exec[k]->set_param(0,&w->last_task_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); } @@ -253,7 +254,6 @@ static int blocks = 48; //static int blocks = 31 * 6 * 24; -static int division = 16; // in Kbyte static void run_start(TaskManager *manager, char *filename,unsigned char *search_word) @@ -283,6 +283,7 @@ } else { w->division_size = w->size; } + w->last_task_size = w->size % w->division_size; /* exec output only "match_num" */ w->status_num = 1;