forums.ps2dev.org Forum Index forums.ps2dev.org
Homebrew PS2, PSP & PS3 Development Discussions
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Code Instrumentation

 
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> PSP Development
View previous topic :: View next topic  
Author Message
71M



Joined: 21 Jun 2005
Posts: 122
Location: London

PostPosted: Fri Oct 14, 2005 6:36 am    Post subject: Code Instrumentation Reply with quote

Has anyone successfully used the gcc -finstrument-functions compile flag to instrument PSP code?

Cheers,
71M
Back to top
View user's profile Send private message
mrbrown



Joined: 17 Jan 2004
Posts: 1536

PostPosted: Fri Oct 14, 2005 10:57 am    Post subject: Reply with quote

There is currently no library support for any of GCC's profiling or instrumentation options.
Back to top
View user's profile Send private message
71M



Joined: 21 Jun 2005
Posts: 122
Location: London

PostPosted: Sun Oct 16, 2005 3:31 am    Post subject: Reply with quote

Ok, thanks. Shame really as it'd be really useful for debugging.

Cheers,
71M
Back to top
View user's profile Send private message
RustyFunkNut



Joined: 26 Sep 2005
Posts: 17
Location: London, UK

PostPosted: Sun Oct 16, 2005 6:56 am    Post subject: Reply with quote

And for profiling :)
Back to top
View user's profile Send private message MSN Messenger
HoldAndModify



Joined: 27 Dec 2005
Posts: 2

PostPosted: Tue Dec 27, 2005 8:06 pm    Post subject: status of profiling support Reply with quote

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
View user's profile Send private message
mrbrown



Joined: 17 Jan 2004
Posts: 1536

PostPosted: Wed Dec 28, 2005 1:04 pm    Post subject: Reply with quote

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
View user's profile Send private message
crazyc



Joined: 17 Jun 2005
Posts: 410

PostPosted: Thu Dec 29, 2005 6:53 am    Post subject: Reply with quote

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
View user's profile Send private message
HoldAndModify



Joined: 27 Dec 2005
Posts: 2

PostPosted: Thu Dec 29, 2005 7:31 am    Post subject: Reply with quote

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
View user's profile Send private message
mrbrown



Joined: 17 Jan 2004
Posts: 1536

PostPosted: Thu Dec 29, 2005 8:10 am    Post subject: Reply with quote

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
View user's profile Send private message
crazyc



Joined: 17 Jun 2005
Posts: 410

PostPosted: Thu Dec 29, 2005 11:07 am    Post subject: Reply with quote

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
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> PSP Development All times are GMT + 10 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group