unknownbrackets / ps2autotests

A set of test programs run on a PS2, with accompanying results.
ISC License
25 stars 7 forks source link

Basic EE performance counter test #37

Closed jpd002 closed 8 years ago

jpd002 commented 8 years ago

This tests the basic behavior of the EE's performance counters feature. The counters can track many types of events, but I've only seen the "processor cycle" event being used in games, which is why I'm only testing that event for now.

I'm not quite sure if the test's location is good, so, just tell me if you think it belongs in a different directory.

unknownbrackets commented 8 years ago

I think I'd prefer it in tests/cpu/ee_cop0/ or ee_cop or similar. I feel like the coprocessor instructions belong in their own group.

Personally I'd use a template for the getCounter/setCounter, but it's the same difference. There's lots more that can be tested (what happens for mfps other than 0? does anything notable happen with a mtps non-0? are there any reliable delay semantics if sync.p is omitted? what happens if you try to use a counter other than 0 and 1? is there any reliable behavior when updating the counter while it's running?) But this is a good test of the essential functionality.

-[Unknown]

jpd002 commented 8 years ago

Thanks for the feedback.

So, I've moved the test to tests/cpu/ee_cop0, which I agree, makes more sense. I've also removed macros in favor of templates for the generation of getCounter and setCounter functions. I've added some tests that demonstrate the behavior of MTPC/MFPC/MTPS/MFPS when using register indices that are not officially supported.

As for testing what omitting sync.p does, I think it would be interesting, but I'm not quite sure what would be the best way to test that. I've also tried writing to a PCR while the counter is active and while it seemed to show reliable behavior, I highly doubt my test proves that the behavior is totally defined (documentation states otherwise). I think we should test for those cases later on as I haven't seen any game relying on this yet.

unknownbrackets commented 8 years ago

Good results, cool. Agreed on sync.p.

I will say that sometimes "undefined" in CPU documentation may mean it's completely defined - for a specific processor. Maybe the R10000 behaves completely differently (mtps etc. are not unique to the R5900.) Other times of course, it can depend on whether things are near a cache line boundary or w/e.

-[Unknown]