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 

Microsecond Accurate Hardware timer

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



Joined: 03 Jun 2007
Posts: 328

PostPosted: Mon Oct 08, 2007 1:37 am    Post subject: Microsecond Accurate Hardware timer Reply with quote

I saw the sample in Kernel/systimer... But that's not what I need.

Could anyone guide me towards what I need to keep track of time in Microseconds?

Thanks,
_________________
Intrigued by PSP system Since December 2006.
Use it more for Development than for Gaming.
Back to top
View user's profile Send private message
TyRaNiD



Joined: 18 Jan 2004
Posts: 918

PostPosted: Mon Oct 08, 2007 2:07 am    Post subject: Reply with quote

RTC? cop0 clock? surely others as well :)
Back to top
View user's profile Send private message
KickinAezz



Joined: 03 Jun 2007
Posts: 328

PostPosted: Tue Oct 09, 2007 1:40 am    Post subject: Reply with quote

RTC... OK

cop0 clock sounds interesting.. Any samples?
_________________
Intrigued by PSP system Since December 2006.
Use it more for Development than for Gaming.
Back to top
View user's profile Send private message
Art



Joined: 09 Nov 2005
Posts: 647

PostPosted: Tue Oct 09, 2007 6:12 pm    Post subject: Reply with quote

did you find the resolution for systimer?
I thought it would be better than microseconds.

Just use the real time clock then.
Back to top
View user's profile Send private message
kolaaaa



Joined: 16 Apr 2007
Posts: 15
Location: Paris

PostPosted: Tue Oct 09, 2007 9:36 pm    Post subject: Reply with quote

For example, I read cop0 counter using this code in kernel mode :

Code:
int
getCycleCounter (void)
{
        int value;
        __asm__ __volatile__(
                "mfc0 %0, $9 \n"
                : "=r" (value));
        return value;
}


Maybe there are a better way to do this ?
Back to top
View user's profile Send private message
KickinAezz



Joined: 03 Jun 2007
Posts: 328

PostPosted: Wed Oct 10, 2007 4:50 am    Post subject: Reply with quote

Art wrote:
did you find the resolution for systimer?
I thought it would be better than microseconds.

Just use the real time clock then.
Using clock() now. Res: defined as CYCLES_PER_SEC = 1000000


Will also try cop0 example above.

Systimer? what?
_________________
Intrigued by PSP system Since December 2006.
Use it more for Development than for Gaming.
Back to top
View user's profile Send private message
Art



Joined: 09 Nov 2005
Posts: 647

PostPosted: Wed Oct 10, 2007 8:41 am    Post subject: Reply with quote

You said in your first post you saw the sample for systimer.
It's tick resolution is unclear at best:
http://www.geardome.com/pspsdk-doc/pspsystimer_8h.html

Was asking did you figure out the tick resolution? I assume not...
Back to top
View user's profile Send private message
KickinAezz



Joined: 03 Jun 2007
Posts: 328

PostPosted: Wed Oct 10, 2007 10:06 am    Post subject: Reply with quote

Art wrote:
You said in your first post you saw the sample for systimer.
It's tick resolution is unclear at best:
http://www.geardome.com/pspsdk-doc/pspsystimer_8h.htmlr

Was asking did you figure out the tick resolution? I assume not...


It needs a callback thread... I wouldn't bother.

Yes, How to find the MAX accurate resolution is unclear.

I'm fixed with clock() and it's very accurate with my stopwatch;


Thanks!
_________________
Intrigued by PSP system Since December 2006.
Use it more for Development than for Gaming.
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