Skip to content

Conversation

@bigianb
Copy link
Contributor

@bigianb bigianb commented Aug 30, 2019

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.

@jpd002
Copy link
Owner

jpd002 commented Sep 12, 2019

Looking good! Did you test it with an executable generated from PS2SDK?

@bigianb
Copy link
Contributor Author

bigianb commented Sep 12, 2019

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;
}

@bigianb
Copy link
Contributor Author

bigianb commented Jan 14, 2021

I've pushed the test code up to a repo:

https://github.com/bigianb/ps2-speedtests

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants