Mercurial > hg > Game > Cerium
diff example/word_count_test/main.cc @ 672:27fec8c70c9c draft
add profiling code
author | Shinji KONO <kono@ie.u-ryukyu.ac.jp> |
---|---|
date | Sat, 05 Dec 2009 20:20:08 +0900 |
parents | 87040ec6b5f6 |
children | 5e5e8eb8da5a |
line wrap: on
line diff
--- a/example/word_count_test/main.cc Sat Dec 05 17:26:58 2009 +0900 +++ b/example/word_count_test/main.cc Sat Dec 05 20:20:08 2009 +0900 @@ -132,6 +132,7 @@ static int blocks = 48; static int division = 16; // in Kbyte +static int profile = 0; static void run_start(TaskManager *manager, char *filename) @@ -192,6 +193,10 @@ /*各SPEの結果を合計して出力するタスク*/ + if (profile) { + manager->start_profile(); + } + #ifdef SIMPLE_TASK t_print = manager->create_task(TASK_PRINT, (memaddr)&w->self,sizeof(memaddr),0,0); @@ -237,6 +242,8 @@ division = atoi(argv[i+1]); } else if (strcmp(argv[i], "-block") == 0) { blocks = atoi(argv[i+1]); + } else if (strcmp(argv[i], "-p") == 0) { + profile = 1; } } if (filename==0) { @@ -247,6 +254,12 @@ return filename; } +static void +myTMend(TaskManager *manager) +{ + manager->show_profile(); +} + int TMmain(TaskManager *manager, int argc, char *argv[]) { @@ -257,6 +270,7 @@ if (filename < 0) { return -1; } + manager->set_TMend(myTMend); task_init(); run_start(manager, filename);