add cache miss analysis debug toy
This commit is contained in:
parent
f841376e58
commit
834bc40a56
|
@ -29,6 +29,7 @@
|
|||
#include "MMU.h"
|
||||
#include "cp15.h"
|
||||
#include "readwrite.h"
|
||||
#include "debug.h"
|
||||
#include "NDSSystem.h"
|
||||
|
||||
////////////////////////////////////////////////////////////////
|
||||
|
@ -318,6 +319,14 @@ FORCEINLINE u32 _MMU_accesstime(u32 addr, bool sequential)
|
|||
// by reading 32 bytes...
|
||||
c += 8 * M32*2;
|
||||
}
|
||||
|
||||
if(CheckDebugEvent(DEBUG_EVENT_CACHE_MISS))
|
||||
{
|
||||
DebugEventData.addr = addr;
|
||||
DebugEventData.size = READSIZE;
|
||||
HandleDebugEvent(DEBUG_EVENT_CACHE_MISS);
|
||||
}
|
||||
|
||||
return c;
|
||||
#elif defined(ACCOUNT_FOR_NON_SEQUENTIAL_ACCESS)
|
||||
// this is the closest approximation I could find
|
||||
|
|
|
@ -43,6 +43,7 @@ u32 debugFlag;
|
|||
|
||||
//DEBUG CONFIGURATION
|
||||
const bool debug_acl = false;
|
||||
const bool debug_cacheMiss = false;
|
||||
|
||||
static bool acl_check_access(u32 adr, u32 access) {
|
||||
|
||||
|
@ -102,6 +103,16 @@ void HandleDebugEvent_Execute()
|
|||
acl_check_access(DebugEventData.addr,CP15_ACCESS_EXECUTE);
|
||||
}
|
||||
|
||||
void HandleDebugEvent_CacheMiss()
|
||||
{
|
||||
if(!debug_cacheMiss) return;
|
||||
extern int currFrameCounter;
|
||||
if(currFrameCounter<200) return;
|
||||
static FILE* outf = NULL;
|
||||
if(!outf) outf = fopen("c:\\miss.txt","wb");
|
||||
fprintf(outf,"%05d,%08X,%d\n",currFrameCounter,DebugEventData.addr,DebugEventData.size);
|
||||
}
|
||||
|
||||
//------------------------------------------------
|
||||
DebugStatistics DEBUG_statistics;
|
||||
|
||||
|
|
|
@ -147,8 +147,9 @@ enum EDEBUG_EVENT
|
|||
{
|
||||
DEBUG_EVENT_READ=1, //read from arm9 or arm7 bus, including cpu prefetch
|
||||
DEBUG_EVENT_WRITE=2, //write on arm9 or arm7 bus
|
||||
DEBUG_EVENT_EXECUTE=4, //prefetch on arm9 or arm7, triggered after the read event
|
||||
DEBUG_EVENT_ACL_EXCEPTION=8, //acl exception on arm9
|
||||
DEBUG_EVENT_EXECUTE=3, //prefetch on arm9 or arm7, triggered after the read event
|
||||
DEBUG_EVENT_ACL_EXCEPTION=4, //acl exception on arm9
|
||||
DEBUG_EVENT_CACHE_MISS=5, //cache miss on arm9
|
||||
};
|
||||
|
||||
enum EDEBUG_NOTIFY
|
||||
|
@ -201,6 +202,7 @@ void HandleDebugEvent_Read();
|
|||
void HandleDebugEvent_Write();
|
||||
void HandleDebugEvent_Execute();
|
||||
void HandleDebugEvent_ACL_Exception();
|
||||
void HandleDebugEvent_CacheMiss();
|
||||
|
||||
inline void HandleDebugEvent(EDEBUG_EVENT event)
|
||||
{
|
||||
|
@ -210,6 +212,7 @@ inline void HandleDebugEvent(EDEBUG_EVENT event)
|
|||
case DEBUG_EVENT_WRITE: HandleDebugEvent_Write(); return;
|
||||
case DEBUG_EVENT_EXECUTE: HandleDebugEvent_Execute(); return;
|
||||
case DEBUG_EVENT_ACL_EXCEPTION: HandleDebugEvent_ACL_Exception(); return;
|
||||
case DEBUG_EVENT_CACHE_MISS: HandleDebugEvent_CacheMiss(); return;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue