mirror of
https://github.com/libretro/pcsx2.git
synced 2024-12-20 08:48:16 +00:00
vtune: count the number of ERET to trigger a quick exit
The purpose is to stop vtune profiling in a predictable way. It allows to compare multiple runs. ERET is called every syscall/interrupt return so it is proportional to the EE program execution.
This commit is contained in:
parent
031b6e6372
commit
7f64f39c05
@ -536,6 +536,24 @@ void BC0TL() {
|
||||
}
|
||||
|
||||
void ERET() {
|
||||
#ifdef ENABLE_VTUNE
|
||||
// Allow to stop vtune in a predictable way to compare runs
|
||||
// Of course, the limit will depend on the game.
|
||||
const u32 million = 1000 * 1000;
|
||||
static u32 vtune = 0;
|
||||
vtune++;
|
||||
|
||||
// quick_exit vs exit: quick_exit won't call static storage destructor (OS will manage). It helps
|
||||
// avoiding the race condition between threads destruction.
|
||||
if (vtune > 30 * million) {
|
||||
Console.WriteLn("VTUNE: quick_exit");
|
||||
std::quick_exit(EXIT_SUCCESS);
|
||||
} else if (!(vtune % million)) {
|
||||
Console.WriteLn("VTUNE: ERET was called %uM times", vtune/million);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
if (cpuRegs.CP0.n.Status.b.ERL) {
|
||||
cpuRegs.pc = cpuRegs.CP0.n.ErrorEPC;
|
||||
cpuRegs.CP0.n.Status.b.ERL = 0;
|
||||
|
Loading…
Reference in New Issue
Block a user