Mercurial > hg > Game > Cerium
comparison example/many_task/main.cc @ 400:984e7890db0c draft
Fix examples.
author | Shinji KONO <kono@ie.u-ryukyu.ac.jp> |
---|---|
date | Mon, 21 Sep 2009 18:47:06 +0900 |
parents | 2c775d229cc6 |
children | 07351a5a51c9 |
comparison
equal
deleted
inserted
replaced
399:943174e92f22 | 400:984e7890db0c |
---|---|
17 static double ed_time; | 17 static double ed_time; |
18 | 18 |
19 static int length = 1200; | 19 static int length = 1200; |
20 | 20 |
21 // prototype | 21 // prototype |
22 void TMend(void); | 22 void TMend(TaskManager *); |
23 | 23 |
24 static double | 24 static double |
25 getTime(void) | 25 getTime(void) |
26 { | 26 { |
27 struct timeval tv; | 27 struct timeval tv; |
57 } | 57 } |
58 | 58 |
59 return 0; | 59 return 0; |
60 } | 60 } |
61 | 61 |
62 extern void sort_init(int, int); | |
63 | |
64 unsigned int ts, te; | 62 unsigned int ts, te; |
65 | 63 |
66 int | 64 int |
67 TMmain(int argc, char *argv[]) | 65 TMmain(TaskManager *manager, int argc, char *argv[]) |
68 { | 66 { |
69 if (init(argc, argv) < 0) { | 67 if (init(argc, argv) < 0) { |
70 return -1; | 68 return -1; |
71 } | 69 } |
72 | 70 |
73 task_init(); | 71 task_init(); |
74 | 72 |
75 sort_init(manager->get_cpuNum(), length); | 73 sort_init(manager, manager->get_cpuNum(), length); |
76 | 74 |
77 st_time = getTime(); | 75 st_time = getTime(); |
78 | 76 |
79 // 全ての Task が終了した後に実行する関数をセット | 77 // 全ての Task が終了した後に実行する関数をセット |
80 manager->set_TMend(TMend); | 78 manager->set_TMend(TMend); |
81 | 79 |
82 return 0; | 80 return 0; |
83 } | 81 } |
84 | 82 |
85 void | 83 void |
86 TMend(void) | 84 TMend(TaskManager *manager) |
87 { | 85 { |
88 ed_time = getTime(); | 86 ed_time = getTime(); |
89 //show_data(); | 87 //show_data(); |
90 printf("Time: %0.6f\n",ed_time-st_time); | 88 printf("Time: %0.6f\n",ed_time-st_time); |
91 } | 89 } |