add an IO Port to get the host clock value
Something like this would allow us to profile test scripts without needing to use the CD clock hack (that is a bit useless in any case from the EE as it goes via an RPC channel which takes an indeterminate amount of time)
Note ... just for discussion at the moment. Not even tested and would need something similar on the IOP side too.
Looking good! Did you test it with an executable generated from PS2SDK?
Looking good! Did you test it with an executable generated from PS2SDK?
yes ... but it's a very trivial test and so not in github yet. Just a POC really. It writes to stdout so the result is in the log file.
#include <tamtypes.h>
#include <stdio.h>
static void Kputc(u8 c) {
while (*((u32*)0x1000f130) & 0x8000) { __asm__ ("nop\nnop\nnop\n"); }
*((u8*)0x1000f180) = c;
}
static void Kputs(u8 *s) {
while (*s != 0) {
Kputc(*s++);
}
}
int main()
{
u32 startTime, endTime, clocksPerSec;
u8 buf[256];
int i;
Kputs("Loop test\n");
startTime = *((u32*)0x10001900);
for (i=0; i<0x10000; ++i){
__asm__ ("nop\nnop\nnop\n");
}
endTime = *((u32*)0x10001900);
clocksPerSec = *((u32*)0x10001904);
sprintf(buf, "start=%d, end=%d, clocksPerSec=%d\n", startTime, endTime, clocksPerSec);
Kputs(buf);
return 0;
}
I've pushed the test code up to a repo:
https://github.com/bigianb/ps2-speedtests