aboutsummaryrefslogtreecommitdiff
path: root/frontend/pcnt.h
diff options
context:
space:
mode:
authornotaz2010-12-11 23:11:46 +0200
committernotaz2010-12-14 15:25:05 +0200
commit722285599b1ce45ca435f484b0f34a5e568487a1 (patch)
tree5f040ca6fe9e2f6bf84a1fefe4a658282e520a15 /frontend/pcnt.h
parentd352cde27e89b1be21bf8f88c3ca79e0eb497165 (diff)
downloadpcsx_rearmed-722285599b1ce45ca435f484b0f34a5e568487a1.tar.gz
pcsx_rearmed-722285599b1ce45ca435f484b0f34a5e568487a1.tar.bz2
pcsx_rearmed-722285599b1ce45ca435f484b0f34a5e568487a1.zip
refactor OSD code and PCNT stuff
Diffstat (limited to 'frontend/pcnt.h')
-rw-r--r--frontend/pcnt.h35
1 files changed, 27 insertions, 8 deletions
diff --git a/frontend/pcnt.h b/frontend/pcnt.h
index 3cf2925..0aca901 100644
--- a/frontend/pcnt.h
+++ b/frontend/pcnt.h
@@ -3,11 +3,17 @@ enum pcounters {
PCNT_ALL,
PCNT_GPU,
PCNT_SPU,
+ PCNT_BLIT,
+ PCNT_TEST,
PCNT_CNT
};
#ifdef PCNT
+static const char *pcnt_names[PCNT_CNT] = { "", "gpu", "spu", "blit", "test" };
+
+#define PCNT_FRAMES 10
+
extern unsigned int pcounters[PCNT_CNT];
extern unsigned int pcounter_starts[PCNT_CNT];
@@ -21,21 +27,34 @@ void pcnt_hook_plugins(void);
static inline void pcnt_print(float fps)
{
- unsigned int total, gpu, spu, rem;
+ static int print_counter;
+ unsigned int total, rem;
int i;
for (i = 0; i < PCNT_CNT; i++)
- pcounters[i] >>= 10;
+ pcounters[i] /= 1000 * PCNT_FRAMES;
- total = pcounters[PCNT_ALL];
- gpu = pcounters[PCNT_GPU];
- spu = pcounters[PCNT_SPU];
- rem = total - gpu - spu;
+ rem = total = pcounters[PCNT_ALL];
+ for (i = 1; i < PCNT_CNT; i++)
+ rem -= pcounters[i];
if (!total)
total++;
- printf("%2.1f %6u %6u %6u (%2d %2d %2d)\n", fps, gpu, spu, rem,
- gpu * 100 / total, spu * 100 / total, rem * 100 / total);
+ if (--print_counter < 0) {
+ printf(" ");
+ for (i = 1; i < PCNT_CNT; i++)
+ printf("%5s ", pcnt_names[i]);
+ printf("%5s\n", "rem");
+ print_counter = 30;
+ }
+
+ printf("%4.1f ", fps);
+ 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);
memset(pcounters, 0, sizeof(pcounters));
}