X-Git-Url: https://notaz.gp2x.de/cgi-bin/gitweb.cgi?p=pcsx_rearmed.git;a=blobdiff_plain;f=frontend%2Fpcnt.h;h=3969aa4ec7688d17e3a6ab8db30c3d8aafea3da5;hp=0aca901edfe01042324ca361a2e906139aca5452;hb=76d1d09c1224af8d663ce63dc5b32425bd62cb29;hpb=722285599b1ce45ca435f484b0f34a5e568487a1 diff --git a/frontend/pcnt.h b/frontend/pcnt.h index 0aca901e..3969aa4e 100644 --- a/frontend/pcnt.h +++ b/frontend/pcnt.h @@ -49,13 +49,25 @@ static inline void pcnt_print(float fps) } printf("%4.1f ", fps); +#if 0 + static float pcounters_all[PCNT_CNT+1]; + static int pcounter_samples; + pcounter_samples++; + + for (i = 1; i < PCNT_CNT; i++) { + pcounters_all[i] += pcounters[i]; + printf("%5.0f ", pcounters_all[i] / pcounter_samples); + } + pcounters_all[i] += rem; + printf("%5.0f\n", pcounters_all[i] / pcounter_samples); +#else for (i = 1; i < PCNT_CNT; i++) printf("%5u ", pcounters[i]); printf("%5u (", rem); for (i = 1; i < PCNT_CNT; i++) printf("%2u ", pcounters[i] * 100 / total); printf("%2u) %u\n", rem * 100 / total, total); - +#endif memset(pcounters, 0, sizeof(pcounters)); } @@ -71,6 +83,19 @@ static inline unsigned int pcnt_get(void) return val; } +static inline void pcnt_init(void) +{ +#ifdef __ARM_ARCH_7A__ + int v; + asm volatile("mrc p15, 0, %0, c9, c12, 0" : "=r"(v)); + v |= 5; // master enable, ccnt reset + v &= ~8; // ccnt divider 0 + asm volatile("mcr p15, 0, %0, c9, c12, 0" :: "r"(v)); + // enable cycle counter + asm volatile("mcr p15, 0, %0, c9, c12, 1" :: "r"(1<<31)); +#endif +} + #else #define pcnt_start(id)