19 unsigned long long counter[pp_total_points];
22 extern struct pp_counters *pp_counters;
25 static __attribute__((always_inline)) inline unsigned int pprof_get_one(void)
27 unsigned long long ret;
28 __asm__ __volatile__ ("rdtsc" : "=A" (ret));
29 return (unsigned int)ret;
31 #define unglitch_timer(x)
33 #elif defined(__GP2X__)
34 // XXX: MMSP2 only, timer sometimes seems to return lower vals?
35 extern volatile unsigned long *gp2x_memregl;
36 #define pprof_get_one() (unsigned int)gp2x_memregl[0x0a00 >> 2]
37 #define unglitch_timer(di) \
38 if ((signed int)(di) < 0) di = 0
44 #define pprof_start(point) { \
45 unsigned int pp_start_##point = pprof_get_one()
47 #define pprof_end(point) \
49 unsigned int di = pprof_get_one() - pp_start_##point; \
51 pp_counters->counter[pp_##point] += di; \
55 // subtract for recursive stuff
56 #define pprof_end_sub(point) \
58 unsigned int di = pprof_get_one() - pp_start_##point; \
60 pp_counters->counter[pp_##point] -= di; \
64 extern void pprof_init(void);
65 extern void pprof_finish(void);