Mercurial > hg > Members > kono > Cerium
comparison TaskManager/Cell/spe/main.cc @ 672:3b6290c05f9f
add profiling code
author | Shinji KONO <kono@ie.u-ryukyu.ac.jp> |
---|---|
date | Sat, 05 Dec 2009 20:20:08 +0900 |
parents | 5530fa36d42e |
children | b386522827ae |
comparison
equal
deleted
inserted
replaced
671:f42b303044f7 | 672:3b6290c05f9f |
---|---|
1 #include <stdio.h> | 1 #include <stdio.h> |
2 #include "CellScheduler.h" | 2 #include "CellScheduler.h" |
3 #include "SpeTaskManagerImpl.h" | 3 #include "SpeTaskManagerImpl.h" |
4 #include "spu_mfcio.h" | 4 #include "spu_mfcio.h" |
5 #include "error.h" | 5 #include "error.h" |
6 #include "SysFunc.h" | |
6 | 7 |
7 extern unsigned char _end[]; | 8 extern unsigned char _end[]; |
9 | |
10 SchedExternTask(ShowTime); | |
11 SchedExternTask(StartProfile); | |
12 | |
8 | 13 |
9 int | 14 int |
10 main(unsigned long long speid, | 15 main(unsigned long long speid, |
11 unsigned long long argc, unsigned long long argv) | 16 unsigned long long argc, unsigned long long argv) |
12 { | 17 { |
20 __debug("code_size:%10d bytes\n", code_size); | 25 __debug("code_size:%10d bytes\n", code_size); |
21 __debug("heap_size:%10d bytes\n", heap_size); | 26 __debug("heap_size:%10d bytes\n", heap_size); |
22 | 27 |
23 TaskManagerImpl *tm = new SpeTaskManagerImpl(); | 28 TaskManagerImpl *tm = new SpeTaskManagerImpl(); |
24 | 29 |
30 SchedRegister(ShowTime); | |
31 SchedRegister(StartProfile); | |
32 | |
25 manager = new CellScheduler(); | 33 manager = new CellScheduler(); |
26 manager->init(tm); | 34 manager->init(tm); |
27 manager->id = (int)argc; | 35 manager->id = (int)argc; |
28 | 36 |
29 tm->set_scheduler(manager); | 37 tm->set_scheduler(manager); |
30 | 38 |
31 spu_write_decrementer(0x7FFFFFFFU); | |
32 unsigned int prof = spu_read_decrementer(); | |
33 manager->run(); | 39 manager->run(); |
34 | |
35 prof -= spu_read_decrementer(); | |
36 | |
37 //printf("%f\n", prof/79800000.0f*1000.0f); | |
38 | 40 |
39 manager->finish(); | 41 manager->finish(); |
40 | 42 |
41 return 0; | 43 return 0; |
42 } | 44 } |