Mercurial > hg > Game > Cerium
view example/Null/main.cc @ 2069:26aa08c9a1de draft default tip
cuda example fix
author | Shinji KONO <kono@ie.u-ryukyu.ac.jp> |
---|---|
date | Sun, 12 Feb 2017 10:04:55 +0900 |
parents | e38a4f3e238d |
children |
line wrap: on
line source
#include <stdio.h> #include <stdlib.h> #include <string.h> #include "TaskManager.h" #include "Func.h" extern void task_init(void); extern TaskManager *manager; static long task_num = 10; /* help文章 */ const char *usr_help_str = "Usage: ./null [-cpu spe_num] [-num N]\n\ -cpu Number of SPE (default 1) \n\ -num Task Num (default 10)"; int init(int argc, char **argv) { for (int i = 1; argv[i]; ++i) { if (strcmp(argv[i], "-num") == 0) { task_num = atoi(argv[++i]); } } return 0; } void null_init(TaskManager *manager) { // Create Task for (long i = 0; i < task_num; i++) { HTask *null = manager->create_task(NullTask); null->set_cpu(SPE_ANY); null->spawn(); } } int TMmain(TaskManager *manager, int argc, char *argv[]) { if (init(argc, argv) < 0) { return -1; } task_init(); null_init(manager); return 0; }