| View previous topic :: View next topic |
| Author |
Message |
71M
Joined: 21 Jun 2005 Posts: 122 Location: London
|
Posted: Fri Oct 14, 2005 6:36 am Post subject: Code Instrumentation |
|
|
Has anyone successfully used the gcc -finstrument-functions compile flag to instrument PSP code?
Cheers,
71M |
|
| Back to top |
|
 |
mrbrown
Joined: 17 Jan 2004 Posts: 1536
|
Posted: Fri Oct 14, 2005 10:57 am Post subject: |
|
|
| There is currently no library support for any of GCC's profiling or instrumentation options. |
|
| Back to top |
|
 |
71M
Joined: 21 Jun 2005 Posts: 122 Location: London
|
Posted: Sun Oct 16, 2005 3:31 am Post subject: |
|
|
Ok, thanks. Shame really as it'd be really useful for debugging.
Cheers,
71M |
|
| Back to top |
|
 |
RustyFunkNut
Joined: 26 Sep 2005 Posts: 17 Location: London, UK
|
Posted: Sun Oct 16, 2005 6:56 am Post subject: |
|
|
| And for profiling :) |
|
| Back to top |
|
 |
HoldAndModify
Joined: 27 Dec 2005 Posts: 2
|
Posted: Tue Dec 27, 2005 8:06 pm Post subject: status of profiling support |
|
|
Hi, just wondering if -pg is supported now? I tried this and received undefined reference to _mcount when building a sample program with this.
If I am doing something wrong, help would be appreciated. Assuming this works, would the profile info be written to some gmon.out on the mem stick?
Thanks... |
|
| Back to top |
|
 |
mrbrown
Joined: 17 Jan 2004 Posts: 1536
|
Posted: Wed Dec 28, 2005 1:04 pm Post subject: |
|
|
| Nope, _mcount isn't defined anywhere. While it would be trivial to add support for counting how many times functions are called, I can't figure out a sane way to do PC sampling with the PSP's OS. |
|
| Back to top |
|
 |
crazyc
Joined: 17 Jun 2005 Posts: 410
|
Posted: Thu Dec 29, 2005 6:53 am Post subject: |
|
|
| mrbrown wrote: | | Nope, _mcount isn't defined anywhere. While it would be trivial to add support for counting how many times functions are called, I can't figure out a sane way to do PC sampling with the PSP's OS. |
Do alarms not interrupt execution, do they not have high enough resolution or is there no way to get the previously running thread PC? |
|
| Back to top |
|
 |
HoldAndModify
Joined: 27 Dec 2005 Posts: 2
|
Posted: Thu Dec 29, 2005 7:31 am Post subject: |
|
|
| mrbrown wrote: | | Nope, _mcount isn't defined anywhere. While it would be trivial to add support for counting how many times functions are called, I can't figure out a sane way to do PC sampling with the PSP's OS. |
Hmm...well, if you'd like to summarize your investigations in this area, I'd be happy to investigate further.
Proper gprof support would probably really help all emu authors optimize things.
Cheers,
HAM |
|
| Back to top |
|
 |
mrbrown
Joined: 17 Jan 2004 Posts: 1536
|
Posted: Thu Dec 29, 2005 8:10 am Post subject: |
|
|
| crazyc wrote: | | Do alarms not interrupt execution, do they not have high enough resolution or is there no way to get the previously running thread PC? |
Right, I couldn't figure out how to get the PC of the current thread. The stupid thread status struct gives you everything except that. I didn't see an easy way to sample the PC in kernel mode either.
Hrm... ok, just had a thought. How about saving the caller's return address in _mcount(), and "sampling" that in an alarm handler? It wouldn't be a precise PC sample but it would at least tell you where all your time was being spent. Of course the other problem with that method is that there's no way to figure out if all your time is being spent in the kernel or in some other PRX. |
|
| Back to top |
|
 |
crazyc
Joined: 17 Jun 2005 Posts: 410
|
Posted: Thu Dec 29, 2005 11:07 am Post subject: |
|
|
| mrbrown wrote: | | Hrm... ok, just had a thought. How about saving the caller's return address in _mcount(), and "sampling" that in an alarm handler? It wouldn't be a precise PC sample but it would at least tell you where all your time was being spent. Of course the other problem with that method is that there's no way to figure out if all your time is being spent in the kernel or in some other PRX. |
Wouldn't it be possible to wrap each kernel entry stub with a function to call mcount? That at least would tell you how much time is being spent in the kernel. |
|
| Back to top |
|
 |
|