13 static const char *pcnt_names[PCNT_CNT] = { "", "gpu", "spu", "blit", "test" };
15 #define PCNT_FRAMES 10
17 extern unsigned int pcounters[PCNT_CNT];
18 extern unsigned int pcounter_starts[PCNT_CNT];
20 #define pcnt_start(id) \
21 pcounter_starts[id] = pcnt_get()
23 #define pcnt_end(id) \
24 pcounters[id] += pcnt_get() - pcounter_starts[id]
26 void pcnt_hook_plugins(void);
28 static inline void pcnt_print(float fps)
30 static int print_counter;
31 unsigned int total, rem;
34 for (i = 0; i < PCNT_CNT; i++)
35 pcounters[i] /= 1000 * PCNT_FRAMES;
37 rem = total = pcounters[PCNT_ALL];
38 for (i = 1; i < PCNT_CNT; i++)
43 if (--print_counter < 0) {
45 for (i = 1; i < PCNT_CNT; i++)
46 printf("%5s ", pcnt_names[i]);
47 printf("%5s\n", "rem");
51 printf("%4.1f ", fps);
53 static float pcounters_all[PCNT_CNT+1];
54 static int pcounter_samples;
57 for (i = 1; i < PCNT_CNT; i++) {
58 pcounters_all[i] += pcounters[i];
59 printf("%5.0f ", pcounters_all[i] / pcounter_samples);
61 pcounters_all[i] += rem;
62 printf("%5.0f\n", pcounters_all[i] / pcounter_samples);
64 for (i = 1; i < PCNT_CNT; i++)
65 printf("%5u ", pcounters[i]);
67 for (i = 1; i < PCNT_CNT; i++)
68 printf("%2u ", pcounters[i] * 100 / total);
69 printf("%2u) %u\n", rem * 100 / total, total);
71 memset(pcounters, 0, sizeof(pcounters));
74 static inline unsigned int pcnt_get(void)
77 #ifdef __ARM_ARCH_7A__
78 __asm__ volatile("mrc p15, 0, %0, c9, c13, 0"
88 #define pcnt_start(id)
90 #define pcnt_hook_plugins()
91 #define pcnt_print(fps)