Mercurial > hg > Game > Cerium
changeset 1505:0ad321ee074d draft
add -count option
author | Yuhi TOMARI <yuhi@cr.ie.u-ryukyu.ac.jp> |
---|---|
date | Fri, 24 Aug 2012 18:03:12 +0900 |
parents | a8724bd966d3 |
children | a7895ab4d0e3 |
files | TaskManager/kernel/main.cc TaskManager/test/GpuRunTest/GpuFunc.h TaskManager/test/GpuRunTest/GpuRunTest.cc TaskManager/test/GpuRunTest/Makefile |
diffstat | 4 files changed, 31 insertions(+), 13 deletions(-) [+] |
line wrap: on
line diff
--- a/TaskManager/kernel/main.cc Wed Aug 22 19:20:34 2012 +0900 +++ b/TaskManager/kernel/main.cc Fri Aug 24 18:03:12 2012 +0900 @@ -34,7 +34,7 @@ int main(int argc, char *argv[]) { - int machineNum = 0; + int machineNum = 1; int speIdle = 0; int useRefDma = 0;
--- a/TaskManager/test/GpuRunTest/GpuFunc.h Wed Aug 22 19:20:34 2012 +0900 +++ b/TaskManager/test/GpuRunTest/GpuFunc.h Fri Aug 24 18:03:12 2012 +0900 @@ -1,5 +1,6 @@ + enum { #include "SysTasks.h" Twice, - Func1, + // Func1, };
--- a/TaskManager/test/GpuRunTest/GpuRunTest.cc Wed Aug 22 19:20:34 2012 +0900 +++ b/TaskManager/test/GpuRunTest/GpuRunTest.cc Fri Aug 24 18:03:12 2012 +0900 @@ -1,4 +1,6 @@ #include <stdio.h> +#include <stdlib.h> +#include <string.h> #include <fcntl.h> #include <sys/stat.h> #include "types.h" @@ -6,10 +8,12 @@ #include "GpuFunc.h" #define DEFAULT 5 +static long int length = DEFAULT; +static int task = 1; + +extern void task_init(void); char usr_help_str[] = "GpuRun [length]\n"; -extern void task_init(void); - void print_data(int *data, int size, const char *title) @@ -33,6 +37,21 @@ } +int +init(int argc, char **argv) +{ + for (int i = 1; argv[i]; ++i) { + if (strcmp(argv[i], "-length") == 0) { + length = atoi(argv[++i]); + } else if (strcmp(argv[i], "-count") == 0) { + task = atoi(argv[++i]); + } + } + + return 0; +} + + void tester(int *indata, int *outdata, int num) { @@ -50,7 +69,7 @@ void -test(TaskManager *manager, long int length) { +test(TaskManager *manager) { int *indata = new int[length]; int *outdata = new int[length]; @@ -80,17 +99,15 @@ int TMmain(TaskManager *manager, int argc, char* argv[]) { - long int length = DEFAULT; - - if (argc > 1) { //引数が渡されていて、 - if(atoi(argv[1])) {//数字なら - length = atoi(argv[1]); - } + if (init(argc, argv) < 0) { + return -1; } task_init(); - test(manager, length); + for (int i = 0; i < task; ++i) { + test(manager); + } return 0; }
--- a/TaskManager/test/GpuRunTest/Makefile Wed Aug 22 19:20:34 2012 +0900 +++ b/TaskManager/test/GpuRunTest/Makefile Fri Aug 24 18:03:12 2012 +0900 @@ -5,7 +5,7 @@ SRCS = $(filter-out $(SRCS_EXCLUDE),$(SRCS_TMP)) OBJS = $(SRCS:.cc=.o) -LIBS += -lGpuManager -framework opencl `sdl-config --libs`#cflags` +LIBS += -lGpuManager -framework opencl `sdl-config --libs` .SUFFIXES: .cc .o