Mercurial > hg > Applications > Grep
diff regexParser/cerium/CeriumMain.cc @ 266:e51cac73e42a
CeriumGrep start
author | masa |
---|---|
date | Thu, 28 Jan 2016 21:14:34 +0900 |
parents | |
children | 0e423d9f9647 |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/regexParser/cerium/CeriumMain.cc Thu Jan 28 21:14:34 2016 +0900 @@ -0,0 +1,49 @@ +#include <stdio.h> +#include <sys/time.h> +#include "TaskManager.h" +#include "SchedTask.h" +#include "Func.h" +#include "FileMapReduce.h" +#include "CeriumGrep.h" + +extern void task_init(); +void TMend(TaskManager *); +static double st_time; +static double ed_time; +const char* usr_help_str = ""; + +static double +getTime() { + struct timeval tv; + gettimeofday(&tv, NULL); + return tv.tv_sec + (double)tv.tv_usec*1e-6; +} + +int +TMmain(TaskManager *manager, int argc, char *argv[]) +{ + char *filename = 0; + Search s = grep(argc,argv,true); + + FileMapReduce *fmp = new FileMapReduce(manager,TASK_EXEC,TASK_EXEC_DATA_PARALLEL,TASK_PRINT); + filename = fmp->init(argc, argv); + fmp->w->global = (void*)s.tg; + if (filename < 0) { + return -1; + } + fmp->division_out_size = sizeof(void*)*3; // *Result,*blockBegin,*blockEnd + task_init(); + st_time = getTime(); + fmp->run_start(manager, filename); + manager->set_TMend(TMend); + return 0; +} + +void +TMend(TaskManager *manager) +{ + ed_time = getTime(); + printf("Time: %0.6f\n",ed_time-st_time); +} + +/* end */