Mercurial > hg > Game > Cerium
changeset 1124:c43f49400c22 draft
add mail profile
author | yutaka@localhost.localdomain |
---|---|
date | Fri, 11 Feb 2011 20:39:24 +0900 |
parents | 2a63ba2c9506 |
children | b733c7903d07 |
files | TaskManager/Cell/spe/CellDmaManager.cc TaskManager/Cell/spe/CellDmaManager.h TaskManager/Cell/spe/ShowTime.cc TaskManager/kernel/schedule/SchedTask.cc TaskManager/kernel/schedule/SchedTask.h TaskManager/kernel/schedule/Scheduler.cc TaskManager/kernel/schedule/Scheduler.h |
diffstat | 7 files changed, 106 insertions(+), 17 deletions(-) [+] |
line wrap: on
line diff
--- a/TaskManager/Cell/spe/CellDmaManager.cc Fri Feb 11 06:09:32 2011 +0900 +++ b/TaskManager/Cell/spe/CellDmaManager.cc Fri Feb 11 20:39:24 2011 +0900 @@ -88,15 +88,26 @@ //ので多少は効果あるといいな。 void CellDmaManager::mail_write_queue(memaddr data) { - (this->*start_dmawait_profile)(); + + + + unsigned long long wait = 0; if (0 != spu_readchcnt(SPU_WrOutMbox)) { if (mail_queue->count()) { + (this->*start_dmawait_profile)(); spu_write_out_mbox((uint32)data); + (this->*end_dmawait_profile)(&wait); + mail_write_time += wait; + global_wait_time += wait; } else { //mail_queue から poll する + (this->*start_dmawait_profile)(); spu_write_out_mbox((uint32)mail_queue->recv()); + (this->*end_dmawait_profile)(&wait); + mail_write_time += wait; + global_wait_time += wait; //mail_queue に加える mail_queue->send(data); @@ -106,25 +117,31 @@ mail_queue->send(data); } - (this->*end_dmawait_profile)(&global_mail_time); + } // tasklist おわりに、MailQueue 全部を書き出す void CellDmaManager::mail_write_finish_list(memaddr data) { - (this->*start_dmawait_profile)(); + unsigned long long wait = 0; while (mail_queue->count()) { + (this->*start_dmawait_profile)(); + spu_write_out_mbox((uint32)mail_queue->recv()); + (this->*end_dmawait_profile)(&wait); - spu_write_out_mbox((uint32)mail_queue->recv()); + global_mail_time += wait; + finish_mail_write_time += wait; } + (this->*start_dmawait_profile)(); spu_write_out_mbox((uint32)data); + (this->*end_dmawait_profile)(&wait); - (this->*end_dmawait_profile)(&global_mail_time); - + global_mail_time += wait; + finish_mail_write_time += wait; } @@ -132,6 +149,8 @@ { + unsigned long long wait = 0; + (this->*start_dmawait_profile)(); memaddr data = (memaddr)spu_read_in_mbox(); @@ -140,9 +159,10 @@ data += (spu_read_in_mbox()<<32); } #endif - (this->*end_dmawait_profile)(&global_mail_time); + (this->*end_dmawait_profile)(&wait); - + global_mail_time += wait; + mail_read_time += wait; return data; } @@ -157,7 +177,7 @@ (this->*end_dmawait_profile)(&wait); - task_list_mail_time += wait; + task_list_mail_read_time += wait; global_mail_time += wait; task_list_read_count += 1; @@ -191,8 +211,13 @@ global_busy_time = 0; global_mail_time = 0; global_wait_time = 0; - task_list_mail_time = 0; + task_list_mail_read_time = 0; + finish_mail_write_time = 0; task_list_read_count = 0; + + mail_read_time = 0; + mail_write_time = 0; + start_dmawait_profile = &CellDmaManager::do_start_dmawait_profile; end_dmawait_profile = &CellDmaManager::do_end_dmawait_profile; @@ -255,30 +280,56 @@ global_busy_time+global_wait_time+global_mail_time ))*100.0; - double t = ((double)task_list_mail_time)/((double)( + double tr = ((double)task_list_mail_read_time)/((double)( + global_busy_time+global_wait_time+global_mail_time + ))*100.0; + + double tw = ((double)finish_mail_write_time)/((double)( + global_busy_time+global_wait_time+global_mail_time + ))*100.0; + + double mr = ((double)mail_read_time)/((double)( + global_busy_time+global_wait_time+global_mail_time + ))*100.0; + + double mw = ((double)mail_write_time)/((double)( global_busy_time+global_wait_time+global_mail_time ))*100.0; - s->printf("spu%d: busy_time = %lld" + s->printf("spu%d:\n busy_time = %lld" " wait_time = %lld(%.3g%%), " " mail_time = %lld(%.3g%%), " - " task_list_mail_time = %lld(%.3g%%), " - " busy_ratio = %.3g%%, " + " mail_read_time = %lld(%.3g%%), " + " mail_write_time = %lld(%.3g%%),\n" + " task_list_mail_read_time = %lld(%.3g%%), " + " finish_mail_write_time = %lld(%.3g%%) " + " busy_ratio = %.3g%%, \n" " task_list_read_count = %d" " average_tasklist_mail_time = %lld" " mainMem_alloc_time = %lld\n" ,cpu, global_busy_time, global_wait_time, d, global_mail_time, m, - task_list_mail_time, t, r, + mail_read_time, mr, + mail_write_time, mw, + task_list_mail_read_time, tr, + finish_mail_write_time, tw, + r, task_list_read_count, - task_list_mail_time / task_list_read_count, + task_list_mail_read_time / task_list_read_count, mainMemalloc_time); global_busy_time = 0; global_mail_time = 0; global_wait_time = 0; - task_list_mail_time = 0; + + mail_read_time = 0; + mail_write_time = 0; + + task_list_mail_read_time = 0; + finish_mail_write_time = 0; + task_list_read_count = 0; + mainMemalloc_time = 0; alloc_flag = 0; }
--- a/TaskManager/Cell/spe/CellDmaManager.h Fri Feb 11 06:09:32 2011 +0900 +++ b/TaskManager/Cell/spe/CellDmaManager.h Fri Feb 11 20:39:24 2011 +0900 @@ -29,6 +29,8 @@ unsigned int wait_time, busy_time, alloc_busy_time; unsigned long long global_busy_time, global_wait_time, global_mail_time, mainMemalloc_time; unsigned long long task_list_mail_time; + unsigned long long mail_read_time, mail_write_time; + unsigned long long task_list_mail_read_time, finish_mail_write_time; int task_list_read_count; /* functions */
--- a/TaskManager/Cell/spe/ShowTime.cc Fri Feb 11 06:09:32 2011 +0900 +++ b/TaskManager/Cell/spe/ShowTime.cc Fri Feb 11 20:39:24 2011 +0900 @@ -12,6 +12,7 @@ */ // printf("Show Time !\n"); smanager->show_dma_wait(); + smanager->show_hash_hit_ratio(); return 0; }
--- a/TaskManager/kernel/schedule/SchedTask.cc Fri Feb 11 06:09:32 2011 +0900 +++ b/TaskManager/kernel/schedule/SchedTask.cc Fri Feb 11 20:39:24 2011 +0900 @@ -251,6 +251,11 @@ scheduler->show_dma_wait(); } +void +SchedTask::show_hash_hit_ratio() { + scheduler->show_hash_hit_ratio(); +} + long SchedTask::get_random() { return scheduler->get_random();
--- a/TaskManager/kernel/schedule/SchedTask.h Fri Feb 11 06:09:32 2011 +0900 +++ b/TaskManager/kernel/schedule/SchedTask.h Fri Feb 11 20:39:24 2011 +0900 @@ -83,6 +83,7 @@ void dma_wait(uint32 mask); void show_dma_wait(); + void show_hash_hit_ratio(); void start_profile();
--- a/TaskManager/kernel/schedule/Scheduler.cc Fri Feb 11 06:09:32 2011 +0900 +++ b/TaskManager/kernel/schedule/Scheduler.cc Fri Feb 11 20:39:24 2011 +0900 @@ -62,6 +62,8 @@ mainMemList[i] = (memaddr)NULL; } + hash_get_count = 0; + hash_hit_count = 0; } @@ -382,11 +384,18 @@ MemorySegment * Scheduler::get_segment(memaddr addr, MemList *m, int size) { + + hash_get_count += 1; + // memory segment のsizeをoverride する場合がある MemorySegment *s = hash->get(addr); + #if 1 if (s) { + + hash_hit_count += 1; + /* 既に load されている */ // this->printf("get_segement loaded %llx 0x%x size 0x%d\n",addr,s->data,size); m->moveToFirst(s); @@ -481,6 +490,23 @@ #endif } +void +Scheduler::show_hash_hit_ratio() +{ + + double ratio = 0; + + if (hash_get_count != 0) { + ratio = ((double)hash_hit_count / (double)hash_get_count)*100; + } + + this->printf("hash_hit_ratio = %.3g%% \n",ratio); + + hash_hit_count = 0; + hash_get_count = 0; + +} + int Scheduler::vprintf0(const char * format, va_list ap)
--- a/TaskManager/kernel/schedule/Scheduler.h Fri Feb 11 06:09:32 2011 +0900 +++ b/TaskManager/kernel/schedule/Scheduler.h Fri Feb 11 20:39:24 2011 +0900 @@ -50,6 +50,8 @@ class Scheduler { private: TaskManagerImpl* manager_tmp; + int hash_get_count; + int hash_hit_count; public: virtual ~Scheduler(); @@ -122,6 +124,7 @@ void dma_wait(uint32 mask); void dma_wait(uint32 mask, int cmd); void show_dma_wait() { connector->show_dma_wait(this, id); }; + void show_hash_hit_ratio(); void start_profile() { connector->start_profile(); }; void mail_write(memaddr data); void mail_write_queue(memaddr data);