mirror of
https://github.com/RaySollium99/picodrive.git
synced 2025-09-05 15:27:46 -04:00
config for x86 (32 bit only, for SH2 drc), add/revive profiling
This commit is contained in:
parent
78d817c370
commit
c1d15f7397
7 changed files with 91 additions and 15 deletions
|
@ -7,21 +7,22 @@ enum pprof_points {
|
|||
pp_draw,
|
||||
pp_sound,
|
||||
pp_m68k,
|
||||
pp_s68k,
|
||||
pp_mem68,
|
||||
pp_z80,
|
||||
pp_msh2,
|
||||
pp_ssh2,
|
||||
pp_memsh,
|
||||
pp_dummy,
|
||||
pp_total_points
|
||||
};
|
||||
|
||||
struct pp_counters
|
||||
{
|
||||
unsigned long long counter[pp_total_points];
|
||||
};
|
||||
|
||||
extern struct pp_counters *pp_counters;
|
||||
extern int *refcounts;
|
||||
|
||||
#ifdef __i386__
|
||||
typedef unsigned long long pp_type;
|
||||
|
||||
static __attribute__((always_inline)) inline unsigned int pprof_get_one(void)
|
||||
{
|
||||
unsigned long long ret;
|
||||
|
@ -31,24 +32,38 @@ static __attribute__((always_inline)) inline unsigned int pprof_get_one(void)
|
|||
#define unglitch_timer(x)
|
||||
|
||||
#elif defined(__GP2X__)
|
||||
typedef unsigned long pp_type;
|
||||
|
||||
#if 0
|
||||
// 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
|
||||
extern unsigned int (*gp2x_get_ticks_us)(void);
|
||||
#define pprof_get_one() gp2x_get_ticks_us()
|
||||
#define unglitch_timer(di) \
|
||||
if ((signed int)(di) < 0) di = 0
|
||||
#endif
|
||||
|
||||
#else
|
||||
#error no timer
|
||||
#endif
|
||||
|
||||
struct pp_counters
|
||||
{
|
||||
pp_type counter[pp_total_points];
|
||||
};
|
||||
|
||||
#define pprof_start(point) { \
|
||||
unsigned int pp_start_##point = pprof_get_one()
|
||||
unsigned int pp_start_##point = pprof_get_one(); refcounts[pp_##point]++
|
||||
|
||||
#define pprof_end(point) \
|
||||
{ \
|
||||
unsigned int di = pprof_get_one() - pp_start_##point; \
|
||||
unglitch_timer(di); \
|
||||
pp_counters->counter[pp_##point] += di; \
|
||||
if (!--refcounts[pp_##point]) pp_counters->counter[pp_##point] += di; \
|
||||
} \
|
||||
}
|
||||
|
||||
|
@ -57,7 +72,7 @@ extern volatile unsigned long *gp2x_memregl;
|
|||
{ \
|
||||
unsigned int di = pprof_get_one() - pp_start_##point; \
|
||||
unglitch_timer(di); \
|
||||
pp_counters->counter[pp_##point] -= di; \
|
||||
if (--refcounts[pp_##point]) pp_counters->counter[pp_##point] -= di; \
|
||||
} \
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue