notaz.gp2x.de
/
picodrive.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
adjust sh2 cycles so that at least Chaotix doesn't glitch so bad
[picodrive.git]
/
platform
/
linux
/
pprof.h
diff --git
a/platform/linux/pprof.h
b/platform/linux/pprof.h
index
88a97e3
..
cccbcbd
100644
(file)
--- a/
platform/linux/pprof.h
+++ b/
platform/linux/pprof.h
@@
-28,11
+28,14
@@
static __attribute__((always_inline)) inline unsigned int pprof_get_one(void)
__asm__ __volatile__ ("rdtsc" : "=A" (ret));
return (unsigned int)ret;
}
__asm__ __volatile__ ("rdtsc" : "=A" (ret));
return (unsigned int)ret;
}
+#define unglitch_timer(x)
#elif defined(__GP2X__)
#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]
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
#else
#error no timer
@@
-40,12
+43,22
@@
extern volatile unsigned long *gp2x_memregl;
#define pprof_start(point) { \
unsigned int pp_start_##point = pprof_get_one()
#define pprof_start(point) { \
unsigned int pp_start_##point = pprof_get_one()
+
#define pprof_end(point) \
#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) \
// 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);
}
extern void pprof_init(void);