Microsecond Accurate Hardware timer

Discuss the development of new homebrew software, tools and libraries.

Moderators: cheriff, TyRaNiD

Post Reply
KickinAezz
Posts: 328
Joined: Sun Jun 03, 2007 10:05 pm

Microsecond Accurate Hardware timer

Post by KickinAezz »

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.
TyRaNiD
Posts: 907
Joined: Sun Jan 18, 2004 12:23 am

Post by TyRaNiD »

RTC? cop0 clock? surely others as well :)
KickinAezz
Posts: 328
Joined: Sun Jun 03, 2007 10:05 pm

Post by KickinAezz »

RTC... OK

cop0 clock sounds interesting.. Any samples?
Intrigued by PSP system Since December 2006.
Use it more for Development than for Gaming.
Art
Posts: 642
Joined: Wed Nov 09, 2005 8:01 am

Post by Art »

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

Just use the real time clock then.
kolaaaa
Posts: 15
Joined: Mon Apr 16, 2007 11:09 pm
Location: Paris

Post by kolaaaa »

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

Code: Select all

int
getCycleCounter (void)
{
        int value;
        __asm__ __volatile__(
                "mfc0 %0, $9 \n"
                : "=r" (value));
        return value;
}
Maybe there are a better way to do this ?
KickinAezz
Posts: 328
Joined: Sun Jun 03, 2007 10:05 pm

Post by KickinAezz »

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.
Art
Posts: 642
Joined: Wed Nov 09, 2005 8:01 am

Post by Art »

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...
KickinAezz
Posts: 328
Joined: Sun Jun 03, 2007 10:05 pm

Post by KickinAezz »

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.
Post Reply