From 82ed88ebe25a0312aab83623b5a983bd96f3d830 Mon Sep 17 00:00:00 2001 From: notaz Date: Wed, 19 Oct 2011 01:58:04 +0300 Subject: [PATCH 1/1] pcnt: measure gte too --- frontend/pcnt.h | 6 +++++- frontend/plugin.c | 11 +++++++++++ libpcsxcore/new_dynarec/assem_arm.c | 8 ++++++++ libpcsxcore/new_dynarec/emu_if.c | 2 +- 4 files changed, 25 insertions(+), 2 deletions(-) diff --git a/frontend/pcnt.h b/frontend/pcnt.h index 3969aa4e..0213ca12 100644 --- a/frontend/pcnt.h +++ b/frontend/pcnt.h @@ -4,13 +4,14 @@ enum pcounters { PCNT_GPU, PCNT_SPU, PCNT_BLIT, + PCNT_GTE, PCNT_TEST, PCNT_CNT }; #ifdef PCNT -static const char *pcnt_names[PCNT_CNT] = { "", "gpu", "spu", "blit", "test" }; +static const char *pcnt_names[PCNT_CNT] = { "", "gpu", "spu", "blit", "gte", "test" }; #define PCNT_FRAMES 10 @@ -96,6 +97,9 @@ static inline void pcnt_init(void) #endif } +void pcnt_gte_start(int op); +void pcnt_gte_end(int op); + #else #define pcnt_start(id) diff --git a/frontend/plugin.c b/frontend/plugin.c index 2492f4ae..e741a1ad 100644 --- a/frontend/plugin.c +++ b/frontend/plugin.c @@ -292,4 +292,15 @@ void pcnt_hook_plugins(void) hook_it(SPU_playCDDAchannel); } +// hooked into recompiler +void pcnt_gte_start(int op) +{ + pcnt_start(PCNT_GTE); +} + +void pcnt_gte_end(int op) +{ + pcnt_end(PCNT_GTE); +} + #endif diff --git a/libpcsxcore/new_dynarec/assem_arm.c b/libpcsxcore/new_dynarec/assem_arm.c index d0d43f44..ddbfafaa 100644 --- a/libpcsxcore/new_dynarec/assem_arm.c +++ b/libpcsxcore/new_dynarec/assem_arm.c @@ -4410,11 +4410,19 @@ void cop2_assemble(int i,struct regstat *i_regs) static void c2op_prologue(u_int op,u_int reglist) { save_regs_all(reglist); +#ifdef PCNT + emit_movimm(op,0); + emit_call((int)pcnt_gte_start); +#endif emit_addimm(FP,(int)&psxRegs.CP2D.r[0]-(int)&dynarec_local,0); // cop2 regs } static void c2op_epilogue(u_int op,u_int reglist) { +#ifdef PCNT + emit_movimm(op,0); + emit_call((int)pcnt_gte_end); +#endif restore_regs_all(reglist); } diff --git a/libpcsxcore/new_dynarec/emu_if.c b/libpcsxcore/new_dynarec/emu_if.c index 485a7c84..b3bcc293 100644 --- a/libpcsxcore/new_dynarec/emu_if.c +++ b/libpcsxcore/new_dynarec/emu_if.c @@ -266,7 +266,7 @@ static int ari64_init() if (psxCP2[i] != psxNULL) gte_handlers[i] = psxCP2[i]; -#if !defined(DRC_DBG) && !defined(PCNT) +#if !defined(DRC_DBG) #ifdef __arm__ gte_handlers[0x06] = gteNCLIP_arm; gte_handlers_nf[0x01] = gteRTPS_nf_arm; -- 2.39.2