Rockbox General > Rockbox General Discussion
Profiling progressing, but need help
lostlogic:
Latest profiling patch, including the parser code is here:
http://lostlogicx.com/transfer/rockbox_profile.patch
Take output from the parser and compare two profiling runs with this perl script:
http://lostlogicx.com/transfer/profile_comparator.pl
Double link is deprecated, but available here: http://lostlogicx.com/transfer/profile-double-link.tar.gz
Design:
* Use -finstrument-functions option from GCC to automatically call profiling functions at entry and exit of each function to profile
* Implement the actual profiling functions under other names to avoid symbol duplication
* Implement small wrapper functions (indirection hurts) to export profiling symbols to APIs or wherever they to be used
* Add calls to switch_thread to shutdown and restart profiling
* Use a wrapper call in thread.c to initiate profiling so that the profiling code knows what thread it belongs to, in theory this could be extended so that we can have per-thread profiling states, but that is not the current situation
* Use statically allocated arrays in memory to store profiling data. I guessed at the sizes for these, there's gotta be a better way to size them to accomodate what is to be profiled
* Pulled from gmon.c in gcc (with credit given) a linked list like structure for profiling data wihch gives flexibility and reasonable speed to finding what counters to increment when
* Use #ifdef RB_PROFILE to keep dis code out when nothing's supposed to be profiled
* Time in functions is recorded in 100us increments.
* Profiling only runs on the thread it's started on so it doesn't have synchronization issues
* Profiling output format is functional, but PC based not symbol name based.
Things that need help:
* Currently I use the 'normal' user timer interface for timer creation, this means that when CPU frequency changes, the timer tries to stay the same length in time. For profiling, you want to measure length in clocks, not in time. We need a different timer initialization that does this. This is a low priority, because profiling is so slow that it's always boosted.
lostlogic:
EEK, don't use the patch until I post a new version, it freezes.
lostlogic:
Ok, so now it doesn't freeze, but the caller data is for the call _site_ not the top of the function... working on it. (same links, just updated)
lostlogic:
Link updated again, now it has the right caller address, but it takes some more instructions to get it. This is somewhat less than stellar, but it works for now.
LinusN:
I like this. Keep up the good work and visit the IRC channel often. :-)
Navigation
[0] Message Index
[#] Next page
Go to full version