From: Bryce D. <br...@tl...> - 2002-03-13 06:24:35
|
I just learned how to use gcc's profiling and code coverage tools, gprof and gcov. Here is a sample. This data was collected during a boot of DLX Linux, about 70 million instructions. You can see which functions are taking up the most time during the process. I made this table by compiling with "gcc -pg", running bochs, and then running gprof. I hope that since FetchDecode represents such a large chunk of the execution time, we can find ways to improve it. I imagine this code is a branch prediction killer. Maybe it would help to rewrite it a few function pointers and a lot fewer switch() statements. And maybe we can store the FetchDecode results for frequently used instructions. [NOTE: tick1 includes handling of all timer triggered devices, such as PIT, keyboard, vga, etc. access_linear and read_physical are memory accesses. dtranslate_linear is paging table lookups.] % time seconds calls name 26.04 17.73 69621020 bx_cpu_c::FetchDecode(unsigned 14.36 9.78 1 bx_cpu_c::cpu_loop(int) 5.79 3.94 79245500 bx_pc_system_c::tick1(void) 5.11 3.48 32099404 bx_cpu_c::access_linear(unsigne 3.48 2.37 19909598 bx_cpu_c::dtranslate_linear(uns 3.10 2.11 1685669 bx_pc_system_c::timer_handler(v 2.89 1.97 10644497 bx_cpu_c::JCC_Jd(BxInstruction_ 2.63 1.79 22066173 bx_mem_c::read_physical(bx_cpu_ 2.61 1.78 47864644 bx_cpu_c::protected_mode(void) 2.61 1.78 18759040 bx_cpu_c::read_virtual_checks(b 2.23 1.52 13772454 bx_cpu_c::read_virtual_dword(un 1.91 1.30 13385236 bx_cpu_c::write_virtual_checks( 1.25 0.85 13371896 bx_mem_c::write_physical(bx_cpu 1.19 0.81 7676838 bx_cpu_c::write_virtual_dword(u 1.07 0.73 7812930 bx_cpu_c::get_ZF(void) 0.97 0.66 6157217 bx_cpu_c::MOV_GdEd(BxInstructio 0.75 0.51 6095406 bx_cpu_c::revalidate_prefetch_q 0.75 0.51 3785671 bx_cpu_c::CMP_EdGd(BxInstructio 0.73 0.50 790981 bx_hard_drive_c::read_handler(v 0.54 0.37 4335024 bx_cpu_c::push_32(unsigned int) The code coverage data was too big to post here, but you can see it all at http://bochs.sf.net/tmp/profiling -Bryce |