Mercurial > hg > Game > Cerium
changeset 1371:66ae94572433 draft
add mail_time in profiler
author | Daichi TOMA <toma@cr.ie.u-ryukyu.ac.jp> |
---|---|
date | Sat, 21 Jan 2012 13:44:48 +0900 |
parents | 6af1f474db3e |
children | f97bb81a034f |
files | TaskManager/Fifo/FifoDmaManager.cc TaskManager/Fifo/FifoDmaManager.h |
diffstat | 2 files changed, 148 insertions(+), 14 deletions(-) [+] |
line wrap: on
line diff
--- a/TaskManager/Fifo/FifoDmaManager.cc Fri Jan 20 17:36:47 2012 +0900 +++ b/TaskManager/Fifo/FifoDmaManager.cc Sat Jan 21 13:44:48 2012 +0900 @@ -113,15 +113,126 @@ } void +FifoDmaManager::mail_write(memaddr data) +{ + unsigned long long wait = 0; + (this->*start_dmawait_profile)(); + + mail_queue1->send(data); + + (this->*end_dmawait_profile)(&wait); + global_mail_time += wait; + mail_write_time += wait; +} + +void +FifoDmaManager::mail_write_queue(memaddr data) +{ + unsigned long long wait = 0; + (this->*start_dmawait_profile)(); + + mail_queue1->send(data); + + (this->*end_dmawait_profile)(&wait); + global_mail_time += wait; + mail_write_time += wait; +} + +void +FifoDmaManager::mail_write_finish_list(memaddr data) +{ + unsigned long long wait = 0; + (this->*start_dmawait_profile)(); + + mail_queue1->send(data); + + (this->*end_dmawait_profile)(&wait); + global_mail_time += wait; + mail_write_time += wait; +} + +memaddr +FifoDmaManager::mail_read() +{ + unsigned long long wait = 0; + (this->*start_dmawait_profile)(); + + memaddr data; + data = mail_queue2->recv(); + + (this->*end_dmawait_profile)(&wait); + global_mail_time += wait; + mail_read_time += wait; + + return data; +} + +memaddr +FifoDmaManager::task_list_mail_read() +{ + unsigned long long wait = 0; + (this->*start_dmawait_profile)(); + + memaddr data; + data = mail_queue2->recv(); + + (this->*end_dmawait_profile)(&wait); + global_mail_time += wait; + mail_read_time += wait; + + return data; +} + +void +FifoDmaManager::mail_write_from_host(memaddr data) +{ + unsigned long long wait = 0; + (this->*start_dmawait_profile)(); + + mail_queue2->send(data); + + (this->*end_dmawait_profile)(&wait); + global_mail_time += wait; + mail_write_from_host_time += wait; +} + +memaddr +FifoDmaManager::mail_read_from_host() +{ + unsigned long long wait = 0; + (this->*start_dmawait_profile)(); + + memaddr data; + data = mail_queue1->recv(); + + (this->*end_dmawait_profile)(&wait); + global_mail_time += wait; + mail_read_from_host_time += wait; + + return data; +} + +int +FifoDmaManager::has_mail_from_host() +{ + return mail_queue1->count(); +} + +void FifoDmaManager::start_profile() { global_busy_time = 0; global_load_time = 0; global_store_time = 0; + global_mail_time = 0; dma_load_time = 0; dma_store_time = 0; dma_loadList_time = 0; dma_storeList_time = 0; + mail_read_time = 0; + mail_write_time = 0; + mail_read_from_host_time = 0; + mail_write_from_host_time = 0; start_dmawait_profile = &FifoDmaManager::do_start_dmawait_profile; end_dmawait_profile = &FifoDmaManager::do_end_dmawait_profile; @@ -133,7 +244,7 @@ FifoDmaManager::stop_profile() { start_time = rdtsc(); - global_busy_time = start_time - stop_time; + global_busy_time += start_time - stop_time; start_dmawait_profile = &FifoDmaManager::null_start_dmawait_profile; end_dmawait_profile = &FifoDmaManager::null_end_dmawait_profile; @@ -159,27 +270,48 @@ void FifoDmaManager::show_dma_wait(Scheduler *s, int cpu) { - unsigned long long all_time = global_busy_time + global_load_time + global_store_time; + unsigned long long all_time = global_busy_time + global_load_time + + global_store_time + global_mail_time; double busy = ((double)global_busy_time)/((double)all_time)*100.0; double load = ((double)global_load_time)/((double)all_time)*100.0; double store = ((double)global_store_time)/((double)all_time)*100.0; + double mail = ((double)global_mail_time)/((double)all_time)*100.0; + double read = ((double)mail_read_time)/((double)all_time)*100.0; + double write = ((double)mail_write_time)/((double)all_time)*100.0; + double read_from_host = ((double)mail_read_from_host_time)/((double)all_time)*100.0; + double write_from_host = ((double)mail_write_from_host_time)/((double)all_time)*100.0; - s->printf("cpu%d:\n busy_time = %lld(%.3g%%), " + s->printf("cpu%d:\n busy_time = %lld(%.3g%%)\n" " load_time = %lld(%.3g%%), " - " store_time = %lld(%.3g%%) \n" + " store_time = %lld(%.3g%%), " + " mail_time = %lld(%.3g%%) \n" + " mail_read_time = %lld(%.3g%%), " + " mail_write_time = %lld(%.3g%%)\n" + " mail_read_from_host_time = %lld(%.3g%%), " + " mail_write_from_host_time = %lld(%.3g%%)\n" ,cpu, global_busy_time, busy, global_load_time, load, - global_store_time, store); + global_store_time, store, + global_mail_time, mail, + mail_read_time, read, + mail_write_time, write, + mail_read_from_host_time, read_from_host, + mail_write_from_host_time, write_from_host); global_busy_time = 0; global_load_time = 0; global_store_time = 0; + global_mail_time = 0; dma_load_time = 0; dma_store_time = 0; dma_loadList_time = 0; dma_storeList_time = 0; + mail_read_time = 0; + mail_write_time = 0; + mail_read_from_host_time = 0; + mail_write_from_host_time = 0; } uint32
--- a/TaskManager/Fifo/FifoDmaManager.h Fri Jan 20 17:36:47 2012 +0900 +++ b/TaskManager/Fifo/FifoDmaManager.h Sat Jan 21 13:44:48 2012 +0900 @@ -40,8 +40,10 @@ /* variables */ protected: unsigned long long start_time, stop_time; - unsigned long long global_busy_time, global_load_time, global_store_time; + unsigned long long global_busy_time, global_load_time, global_store_time, global_mail_time; unsigned long long dma_load_time, dma_store_time, dma_loadList_time, dma_storeList_time; + unsigned long long mail_read_time, mail_write_time; + unsigned long long mail_read_from_host_time, mail_write_from_host_time; /* functions */ public: @@ -56,15 +58,15 @@ void show_dma_wait(Scheduler *s, int cpu); - void mail_write(memaddr data) { mail_queue1->send(data); } - void mail_write_queue(memaddr data) { mail_queue1->send(data); } - void mail_write_finish_list(memaddr data) { mail_queue1->send(data); } - memaddr mail_read() { return mail_queue2->recv(); } - memaddr task_list_mail_read() { return mail_queue2->recv(); } + void mail_write(memaddr data); + void mail_write_queue(memaddr data); + void mail_write_finish_list(memaddr data); + memaddr mail_read(); + memaddr task_list_mail_read(); - void mail_write_from_host(memaddr data) { mail_queue2->send(data); } - memaddr mail_read_from_host() { return mail_queue1->recv(); } - int has_mail_from_host() { return mail_queue1->count(); } + void mail_write_from_host(memaddr data); + memaddr mail_read_from_host(); + int has_mail_from_host(); virtual void *dma_loadList(Scheduler *s, ListDataPtr list, void *buff, uint32 mask); void dma_storeList(ListDataPtr, void *buff, uint32 mask);