mirror of
https://github.com/RaySollium99/picodrive.git
synced 2025-09-05 07:17:45 -04:00
simple profiler added
git-svn-id: file:///home/notaz/opt/svn/PicoDrive@850 be3aeb3a-fb24-0410-a615-afba39da0efa
This commit is contained in:
parent
e05b81fc5b
commit
f6c49d38cb
12 changed files with 258 additions and 8 deletions
|
@ -165,6 +165,8 @@ static void p32x_start_blank(void)
|
|||
|
||||
static __inline void run_m68k(int cyc)
|
||||
{
|
||||
pprof_start(m68k);
|
||||
|
||||
#if defined(EMU_C68K)
|
||||
PicoCpuCM68k.cycles = cyc;
|
||||
CycloneRun(&PicoCpuCM68k);
|
||||
|
@ -174,6 +176,8 @@ static __inline void run_m68k(int cyc)
|
|||
#elif defined(EMU_F68K)
|
||||
SekCycleCnt += fm68k_emulate(cyc+1, 0, 0);
|
||||
#endif
|
||||
|
||||
pprof_end(m68k);
|
||||
}
|
||||
|
||||
// ~1463.8, but due to cache misses and slow mem
|
||||
|
@ -194,10 +198,18 @@ static __inline void run_m68k(int cyc)
|
|||
slice = SekCycleCnt - slice; /* real count from 68k */ \
|
||||
if (SekCycleCnt < SekCycleAim) \
|
||||
elprintf(EL_32X, "slice %d", slice); \
|
||||
if (!(Pico32x.emu_flags & (P32XF_SSH2POLL|P32XF_SSH2VPOLL))) \
|
||||
if (!(Pico32x.emu_flags & (P32XF_SSH2POLL|P32XF_SSH2VPOLL))) { \
|
||||
pprof_start(ssh2); \
|
||||
sh2_execute(&ssh2, CYCLES_M68K2SH2(slice)); \
|
||||
if (!(Pico32x.emu_flags & (P32XF_MSH2POLL|P32XF_MSH2VPOLL))) \
|
||||
pprof_end(ssh2); \
|
||||
} \
|
||||
if (!(Pico32x.emu_flags & (P32XF_MSH2POLL|P32XF_MSH2VPOLL))) { \
|
||||
pprof_start(msh2); \
|
||||
sh2_execute(&msh2, CYCLES_M68K2SH2(slice)); \
|
||||
pprof_end(msh2); \
|
||||
} \
|
||||
pprof_start(dummy); \
|
||||
pprof_end(dummy); \
|
||||
} \
|
||||
}
|
||||
|
||||
|
|
|
@ -66,6 +66,9 @@ PICO_INTERNAL int PicoResetMCD(void)
|
|||
static __inline void SekRunM68k(int cyc)
|
||||
{
|
||||
int cyc_do;
|
||||
|
||||
pprof_start(m68k);
|
||||
|
||||
SekCycleAim+=cyc;
|
||||
if ((cyc_do=SekCycleAim-SekCycleCnt) <= 0) return;
|
||||
#if defined(EMU_CORE_DEBUG)
|
||||
|
@ -81,6 +84,7 @@ static __inline void SekRunM68k(int cyc)
|
|||
g_m68kcontext=&PicoCpuFM68k;
|
||||
SekCycleCnt+=fm68k_emulate(cyc_do, 0, 0);
|
||||
#endif
|
||||
pprof_end(m68k);
|
||||
}
|
||||
|
||||
static __inline void SekRunS68k(int cyc)
|
||||
|
|
|
@ -1485,6 +1485,8 @@ void PicoDrawSync(int to, int blank_last_line)
|
|||
int sh = (Pico.video.reg[0xC] & 8) >> 3; // shadow/hilight?
|
||||
int bgc = Pico.video.reg[7];
|
||||
|
||||
pprof_start(draw);
|
||||
|
||||
if (rendlines != 240)
|
||||
offs = 8;
|
||||
|
||||
|
@ -1516,6 +1518,8 @@ void PicoDrawSync(int to, int blank_last_line)
|
|||
line++;
|
||||
}
|
||||
DrawScanline = line;
|
||||
|
||||
pprof_end(draw);
|
||||
}
|
||||
|
||||
void PicoDrawSetColorFormat(int which)
|
||||
|
|
|
@ -257,8 +257,11 @@ void NOINLINE ctl_write_z80busreq(u32 d)
|
|||
else
|
||||
{
|
||||
z80stopCycle = SekCyclesDone();
|
||||
if ((PicoOpt&POPT_EN_Z80) && !Pico.m.z80_reset)
|
||||
if ((PicoOpt&POPT_EN_Z80) && !Pico.m.z80_reset) {
|
||||
pprof_start(m68k);
|
||||
PicoSyncZ80(z80stopCycle);
|
||||
pprof_end_sub(m68k);
|
||||
}
|
||||
}
|
||||
Pico.m.z80Run = d;
|
||||
}
|
||||
|
@ -272,8 +275,11 @@ void NOINLINE ctl_write_z80reset(u32 d)
|
|||
{
|
||||
if (d)
|
||||
{
|
||||
if ((PicoOpt&POPT_EN_Z80) && Pico.m.z80Run)
|
||||
if ((PicoOpt&POPT_EN_Z80) && Pico.m.z80Run) {
|
||||
pprof_start(m68k);
|
||||
PicoSyncZ80(SekCyclesDone());
|
||||
pprof_end_sub(m68k);
|
||||
}
|
||||
YM2612ResetChip();
|
||||
timers_reset();
|
||||
}
|
||||
|
|
19
pico/pico.c
19
pico/pico.c
|
@ -272,6 +272,8 @@ PICO_INTERNAL int CheckDMA(void)
|
|||
static __inline void SekRunM68k(int cyc)
|
||||
{
|
||||
int cyc_do;
|
||||
pprof_start(m68k);
|
||||
|
||||
SekCycleAim+=cyc;
|
||||
if ((cyc_do=SekCycleAim-SekCycleCnt) <= 0) return;
|
||||
#if defined(EMU_CORE_DEBUG)
|
||||
|
@ -286,6 +288,8 @@ static __inline void SekRunM68k(int cyc)
|
|||
#elif defined(EMU_F68K)
|
||||
SekCycleCnt+=fm68k_emulate(cyc_do+1, 0, 0);
|
||||
#endif
|
||||
|
||||
pprof_end(m68k);
|
||||
}
|
||||
|
||||
#include "pico_cmn.c"
|
||||
|
@ -303,38 +307,47 @@ PICO_INTERNAL void PicoSyncZ80(int m68k_cycles_done)
|
|||
z80_cycle_aim = cycles_68k_to_z80(m68k_cycles_done);
|
||||
cnt = z80_cycle_aim - z80_cycle_cnt;
|
||||
|
||||
pprof_start(z80);
|
||||
|
||||
elprintf(EL_BUSREQ, "z80 sync %i (%i|%i -> %i|%i)", cnt, z80_cycle_cnt, z80_cycle_cnt / 228,
|
||||
z80_cycle_aim, z80_cycle_aim / 228);
|
||||
|
||||
if (cnt > 0)
|
||||
z80_cycle_cnt += z80_run(cnt);
|
||||
|
||||
pprof_end(z80);
|
||||
}
|
||||
|
||||
|
||||
void PicoFrame(void)
|
||||
{
|
||||
pprof_start(frame);
|
||||
|
||||
Pico.m.frame_count++;
|
||||
|
||||
if (PicoAHW & PAHW_SMS) {
|
||||
PicoFrameMS();
|
||||
return;
|
||||
goto end;
|
||||
}
|
||||
|
||||
// TODO: MCD+32X
|
||||
if (PicoAHW & PAHW_MCD) {
|
||||
PicoFrameMCD();
|
||||
return;
|
||||
goto end;
|
||||
}
|
||||
|
||||
if (PicoAHW & PAHW_32X) {
|
||||
PicoFrame32x();
|
||||
return;
|
||||
goto end;
|
||||
}
|
||||
|
||||
//if(Pico.video.reg[12]&0x2) Pico.video.status ^= 0x10; // change odd bit in interlace mode
|
||||
|
||||
PicoFrameStart();
|
||||
PicoFrameHints();
|
||||
|
||||
end:
|
||||
pprof_end(frame);
|
||||
}
|
||||
|
||||
void PicoFrameDrawOnly(void)
|
||||
|
|
|
@ -779,6 +779,18 @@ extern void lprintf(const char *fmt, ...);
|
|||
#define elprintf(w,f,...)
|
||||
#endif
|
||||
|
||||
// profiling
|
||||
#ifdef PPROF
|
||||
#include <platform/linux/pprof.h>
|
||||
#else
|
||||
#define pprof_init()
|
||||
#define pprof_finish()
|
||||
#define pprof_start(x)
|
||||
#define pprof_end(...)
|
||||
#define pprof_end_sub(...)
|
||||
#endif
|
||||
|
||||
// misc
|
||||
#ifdef _MSC_VER
|
||||
#define cdprintf
|
||||
#else
|
||||
|
|
|
@ -308,6 +308,8 @@ static int PsndRender(int offset, int length)
|
|||
(Pico_mcd->pcm.control & 0x80) && Pico_mcd->pcm.enabled;
|
||||
offset <<= stereo;
|
||||
|
||||
pprof_start(sound);
|
||||
|
||||
#if !SIMPLE_WRITE_SOUND
|
||||
if (offset == 0) { // should happen once per frame
|
||||
// compensate for float part of PsndLen
|
||||
|
@ -362,6 +364,8 @@ static int PsndRender(int offset, int length)
|
|||
// convert + limit to normal 16bit output
|
||||
PsndMix_32_to_16l(PsndOut+offset, buf32, length);
|
||||
|
||||
pprof_end(sound);
|
||||
|
||||
return length;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue