| View previous topic :: View next topic |
| Author |
Message |
KickinAezz
Joined: 03 Jun 2007 Posts: 328
|
Posted: Mon Oct 08, 2007 1:37 am Post subject: Microsecond Accurate Hardware timer |
|
|
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 |
|
 |
TyRaNiD
Joined: 18 Jan 2004 Posts: 918
|
Posted: Mon Oct 08, 2007 2:07 am Post subject: |
|
|
| RTC? cop0 clock? surely others as well :) |
|
| Back to top |
|
 |
KickinAezz
Joined: 03 Jun 2007 Posts: 328
|
Posted: Tue Oct 09, 2007 1:40 am Post subject: |
|
|
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 |
|
 |
Art
Joined: 09 Nov 2005 Posts: 647
|
Posted: Tue Oct 09, 2007 6:12 pm Post subject: |
|
|
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 |
|
 |
kolaaaa
Joined: 16 Apr 2007 Posts: 15 Location: Paris
|
Posted: Tue Oct 09, 2007 9:36 pm Post subject: |
|
|
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 |
|
 |
KickinAezz
Joined: 03 Jun 2007 Posts: 328
|
Posted: Wed Oct 10, 2007 4:50 am Post subject: |
|
|
| 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 |
|
 |
Art
Joined: 09 Nov 2005 Posts: 647
|
Posted: Wed Oct 10, 2007 8:41 am Post subject: |
|
|
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 |
|
 |
KickinAezz
Joined: 03 Jun 2007 Posts: 328
|
Posted: Wed Oct 10, 2007 10:06 am Post subject: |
|
|
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 |
|
 |
|