\r
PICO_INTERNAL void PicoFrameFull()\r
{\r
+ pprof_start(draw);\r
+\r
// prepare cram?\r
if (PicoPrepareCram) PicoPrepareCram();\r
\r
// Draw screen:\r
BackFillFull(Pico.video.reg[7]);\r
- if (Pico.video.reg[1]&0x40) DrawDisplayFull();\r
+ if (Pico.video.reg[1] & 0x40)\r
+ DrawDisplayFull();\r
+\r
+ pprof_end(draw);\r
}\r
\r
$(CC) $(CFLAGS) $^ $(LDFLAGS) -Wl,-Map=PicoDrive.map -o $@
pprof: pprof.c
- $(CROSS)gcc -O2 -ggdb -DPPROF -DPPROF_TOOL -I../../ -I. $^ -o $@ -lrt
+ $(CROSS)gcc -O2 -ggdb -DPPROF -DPPROF_TOOL -I../../ -I. $^ -o $@
%.o : %.asm
@echo ">>>" $<
__asm__ __volatile__ ("rdtsc" : "=A" (ret));
return (unsigned int)ret;
}
+#define unglitch_timer(x)
#elif defined(__GP2X__)
-// XXX: MMSP2 only
+// XXX: MMSP2 only, timer sometimes seems to return lower vals?
extern volatile unsigned long *gp2x_memregl;
#define pprof_get_one() (unsigned int)gp2x_memregl[0x0a00 >> 2]
+#define unglitch_timer(di) \
+ if ((signed int)(di) < 0) di = 0
#else
#error no timer
#define pprof_start(point) { \
unsigned int pp_start_##point = pprof_get_one()
+
#define pprof_end(point) \
- pp_counters->counter[pp_##point] += pprof_get_one() - pp_start_##point; \
+ { \
+ unsigned int di = pprof_get_one() - pp_start_##point; \
+ unglitch_timer(di); \
+ pp_counters->counter[pp_##point] += di; \
+ } \
}
+
// subtract for recursive stuff
#define pprof_end_sub(point) \
- pp_counters->counter[pp_##point] -= pprof_get_one() - pp_start_##point; \
+ { \
+ unsigned int di = pprof_get_one() - pp_start_##point; \
+ unglitch_timer(di); \
+ pp_counters->counter[pp_##point] -= di; \
+ } \
}
extern void pprof_init(void);