Mercurial > hg > Game > Cerium
comparison TaskManager/kernel/ppe/CpuThreads.cc @ 1872:a1bfda09128a draft
add IO threads in CpuThreads
author | masa |
---|---|
date | Fri, 27 Dec 2013 20:58:30 +0900 |
parents | b53d197ec03d |
children | accb35bd3449 |
comparison
equal
deleted
inserted
replaced
1871:c3f7ba33222d | 1872:a1bfda09128a |
---|---|
15 SchedExternTask(StartProfile); | 15 SchedExternTask(StartProfile); |
16 | 16 |
17 /** | 17 /** |
18 id_offset is gpu_num | 18 id_offset is gpu_num |
19 */ | 19 */ |
20 CpuThreads::CpuThreads(int num, int useRefDma, int start_id) : cpu_num(num), use_refdma(useRefDma), id_offset(start_id) { | 20 CpuThreads::CpuThreads(int num,int i_num, int useRefDma, int start_id) : |
21 cpu_num(num), use_refdma(useRefDma), id_offset(start_id) { | |
22 io_num = 2; | |
21 #ifdef __CERIUM_GPU__ | 23 #ifdef __CERIUM_GPU__ |
22 gpu = new GpuThreads(useRefDma); | 24 gpu = new GpuThreads(useRefDma); |
23 #endif | 25 #endif |
24 threads = new pthread_t[cpu_num]; | 26 threads = new pthread_t[cpu_num+io_num]; |
25 args = new cpu_thread_arg_t[cpu_num+id_offset]; | 27 args = new cpu_thread_arg_t[cpu_num+io_num+id_offset]; |
26 wait = new Sem(0); | 28 wait = new Sem(0); |
27 | 29 |
28 } | 30 } |
29 | 31 |
30 CpuThreads::~CpuThreads() | 32 CpuThreads::~CpuThreads() |
31 { | 33 { |
32 memaddr mail = (memaddr)MY_SPE_COMMAND_EXIT; | 34 memaddr mail = (memaddr)MY_SPE_COMMAND_EXIT; |
33 | 35 |
34 for (int i = 0; i < cpu_num; i++) { | 36 for (int i = 0; i < cpu_num+io_num; i++) { |
35 send_mail(i+id_offset, 1, &mail); | 37 send_mail(i+id_offset, 1, &mail); |
36 } | 38 } |
37 | 39 |
38 for (int i = 0; i < cpu_num; i++) { | 40 for (int i = 0; i < cpu_num+io_num; i++) { |
39 pthread_join(threads[i], NULL); | 41 pthread_join(threads[i], NULL); |
40 } | 42 } |
41 | 43 |
42 for (int i = 0; i < cpu_num; i++) { | 44 for (int i = 0; i < cpu_num+io_num; i++) { |
43 delete args[i].scheduler; | 45 delete args[i].scheduler; |
44 } | 46 } |
45 | 47 |
46 delete [] threads; | 48 delete [] threads; |
47 delete [] args; | 49 delete [] args; |
62 c_scheduler->mincpu = (int)argt->id_offset; | 64 c_scheduler->mincpu = (int)argt->id_offset; |
63 c_scheduler->maxcpu = (int)argt->cpu_num + (int)argt->id_offset; | 65 c_scheduler->maxcpu = (int)argt->cpu_num + (int)argt->id_offset; |
64 manager->set_scheduler(c_scheduler); | 66 manager->set_scheduler(c_scheduler); |
65 SchedRegister(ShowTime); | 67 SchedRegister(ShowTime); |
66 SchedRegister(StartProfile); | 68 SchedRegister(StartProfile); |
69 if (argt->cpuid >= cpu_num) | |
70 pthread_setschedparam(); | |
67 | 71 |
68 argt->wait->sem_v(); //準備完了したスレッドができるたびに+1していく | 72 argt->wait->sem_v(); //準備完了したスレッドができるたびに+1していく |
69 | 73 |
70 c_scheduler->run(new SchedNop()); | 74 c_scheduler->run(new SchedNop()); |
71 c_scheduler->finish(); | 75 c_scheduler->finish(); |