changeset 1600:e63ce6aee28e draft

eraser word_count's tarces in regex_mas
author Masa <e085726@ie.u-ryukyu.ac.jp>
date Thu, 04 Apr 2013 15:48:33 +0900
parents 549d0961980b
children 4ad9b94141b5
files example/regex_mas/main.cc example/regex_mas/ppe/Exec.cc example/regex_mas/ppe/Print.cc
diffstat 3 files changed, 16 insertions(+), 40 deletions(-) [+]
line wrap: on
line diff
--- a/example/regex_mas/main.cc	Tue Apr 02 19:01:35 2013 +0900
+++ b/example/regex_mas/main.cc	Thu Apr 04 15:48:33 2013 +0900
@@ -18,8 +18,8 @@
 
 extern void task_init();
 void TMend(TaskManager *);
-static double st_time;
-static double ed_time;
+//static double st_time;
+//static double ed_time;
 int all = 0;
 int use_task_array = 1;
 int use_task_creater = 0;
@@ -29,12 +29,12 @@
 CPU_TYPE spe_cpu = SPE_ANY;
 const char *usr_help_str = "Usage: ./word_count [-a -c -s] [-cpu spe_num] [-file filename]\n";
 
-static double
-getTime() {
-    struct timeval tv;
-    gettimeofday(&tv, NULL);
-    return tv.tv_sec + (double)tv.tv_usec*1e-6;
-}
+//static double
+//getTime() {
+//    struct timeval tv;
+//    gettimeofday(&tv, NULL);
+//    return tv.tv_sec + (double)tv.tv_usec*1e-6;
+//}
 
 typedef struct {
     caddr_t file_mmap;
@@ -168,13 +168,9 @@
         fprintf(stderr,"can't fstat %s\n",filename);
     }
 
-    printf("file size %d\n",(int)sb.st_size);
-
     /*sizeをページングサイズの倍数にあわせる*/
     st_mmap.size = fix_byte(sb.st_size,4096);
 
-    printf("fix 4096byte file size %d\n",(int)st_mmap.size);
-
     st_mmap.file_mmap = (char*)mmap(NULL,st_mmap.size,PROT_READ,map,fd,(off_t)0);
     if (st_mmap.file_mmap == (caddr_t)-1) {
         fprintf(stderr,"Can't mmap file\n");
@@ -390,8 +386,6 @@
     /*sizeはdivision_sizeの倍数にしている。*/
     w->size = w->file_size = st_mmap.size;
     w->file_mmap = st_mmap.file_mmap;
-    printf("w %lx\n",(long)w);
-
     /* 1task分のデータサイズ(byte) */
     if (w->size >= 1024*division) {
         w->division_size = 1024 * division;/*16kbyte*/
@@ -399,8 +393,6 @@
         w->division_size = w->size;
     }
 
-    printf("dvision_size %d\n",w->division_size);
-
     /* "word num" and "line num" */
     w->status_num = 2;
     /* taskの数 */
@@ -415,8 +407,6 @@
     }
 
     w->out_task_num = out_task_num;
-    printf("task_num %d\n",w->task_num);
-    printf("out_task_num %d\n",w->out_task_num);
 
     /* out用のdivision_size. statusが2つなので、あわせて16byteになるように、long long(4byte)を使用 */
 
@@ -424,7 +414,6 @@
     int out_size = w->division_out_size*out_task_num;
     w->o_data = (unsigned long long *)manager->allocate(out_size);
     w->out_size = 4;
-    printf("out size %d\n",out_size);
 
     /*各SPEの結果を合計して出力するタスク*/
 
@@ -501,16 +490,7 @@
 
     task_init();
     run_start(manager, filename);
-    st_time = getTime();
-    manager->set_TMend(TMend);
     return 0;
 }
 
-void
-TMend(TaskManager *manager)
-{
-    ed_time = getTime();
-    printf("Time: %0.6f\n",ed_time-st_time);
-}
-
 /* end */
--- a/example/regex_mas/ppe/Exec.cc	Tue Apr 02 19:01:35 2013 +0900
+++ b/example/regex_mas/ppe/Exec.cc	Thu Apr 04 15:48:33 2013 +0900
@@ -20,9 +20,8 @@
     bool line_flag = false;
     bool word_head_a_flag = false; 
 
-    //head_tail_flag[0] = (i_data[0] != 0x20) && (i_data[0] != 0x0A);
+    head_tail_flag[0] = (i_data[0] != 0x20) && (i_data[0] != 0x0A);
     //word_num -= 1-head_tail_flag[0];
-    head_tail_flag[0] = (i_data[0] == 0x62);
 
     for (; i < length; i++) {
         if (i_data[i] == 0x61) {
@@ -45,9 +44,9 @@
     }
 
     //head_tail_flag[1] = (i_data[i-1] != 0x20) && (i_data[i-1] != 0x0A);
-    head_tail_flag[1] = (i_data[i-1] == 0x61);
+    head_tail_flag[1] = (word_head_a_flag == true);
 
-    s->printf("SPE include 'ab' %d lines. %d words. \n",line_num,word_num);
+    s->printf("SPE include 'a*b' %d lines. %d words. \n",line_num,word_num);
 
     o_data[0] = (unsigned long long)word_num;
     o_data[1] = (unsigned long long)line_num;
--- a/example/regex_mas/ppe/Print.cc	Tue Apr 02 19:01:35 2013 +0900
+++ b/example/regex_mas/ppe/Print.cc	Thu Apr 04 15:48:33 2013 +0900
@@ -60,7 +60,7 @@
      *
      */
 
-    s->printf("start sum\n");
+    //s->printf("start sum\n");
 
     for (int i = 0; i < status_num; i++) {
         word_data[i] = 0;
@@ -79,14 +79,11 @@
 
     word_data[0] += flag_cal_sum;
 
-    for (int i = status_num-1; i >=0; i--) {
-        s->printf("%llu ",word_data[i]);
-    }
+    //for (int i = status_num-1; i >=0; i--) {
+    //    s->printf("%llu ",word_data[i]);
+    //}
 
-    //printf("j = %d\n",j);
-
-
-    s->printf("\n");
+    //s->printf("\n");
 
     return 0;
 }