mirror of https://github.com/PCSX2/pcsx2.git
common: improve vtune merge support
Mapping the full buffer is killer on Vtune (either crash or requires a huge processing time). Instead keep the same ID for code in the same buffers. I think all buffers are correctly mapped now but I still miss the frame pointer for VU code.
This commit is contained in:
parent
b9369e7c00
commit
031b6e6372
|
@ -36,6 +36,7 @@ class InfoVector
|
||||||
{
|
{
|
||||||
std::vector<Info> m_v;
|
std::vector<Info> m_v;
|
||||||
char m_prefix[20];
|
char m_prefix[20];
|
||||||
|
unsigned int m_vtune_id;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
InfoVector(const char *prefix);
|
InfoVector(const char *prefix);
|
||||||
|
|
|
@ -76,6 +76,11 @@ void Info::Print(FILE *fp)
|
||||||
InfoVector::InfoVector(const char *prefix)
|
InfoVector::InfoVector(const char *prefix)
|
||||||
{
|
{
|
||||||
strncpy(m_prefix, prefix, sizeof(m_prefix));
|
strncpy(m_prefix, prefix, sizeof(m_prefix));
|
||||||
|
#ifdef ENABLE_VTUNE
|
||||||
|
m_vtune_id = iJIT_GetNewMethodID();
|
||||||
|
#else
|
||||||
|
m_vtune_id = 0;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void InfoVector::print(FILE *fp)
|
void InfoVector::print(FILE *fp)
|
||||||
|
@ -90,18 +95,16 @@ void InfoVector::map(uptr x86, u32 size, const char *symbol)
|
||||||
// Dispatchers are on a page and must always be kept.
|
// Dispatchers are on a page and must always be kept.
|
||||||
// Recompilers are much bigger (TODO check VIF) and are only
|
// Recompilers are much bigger (TODO check VIF) and are only
|
||||||
// useful when MERGE_BLOCK_RESULT is defined
|
// useful when MERGE_BLOCK_RESULT is defined
|
||||||
|
#if defined(ENABLE_VTUNE) || !defined(MERGE_BLOCK_RESULT)
|
||||||
#ifdef MERGE_BLOCK_RESULT
|
u32 max_code_size = 16 * _1kb;
|
||||||
m_v.emplace_back(x86, size, symbol);
|
|
||||||
#else
|
#else
|
||||||
if (size < 8 * _1kb)
|
u32 max_code_size = _1gb;
|
||||||
m_v.emplace_back(x86, size, symbol);
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
if (size < max_code_size) {
|
||||||
|
m_v.emplace_back(x86, size, symbol);
|
||||||
|
|
||||||
#ifdef ENABLE_VTUNE
|
#ifdef ENABLE_VTUNE
|
||||||
// mapping the full recompiler will blow up VTUNE
|
|
||||||
if (size < _16kb) {
|
|
||||||
fprintf(stderr, "map %s: %p size %d\n", symbol, (void *)x86, size);
|
|
||||||
std::string name = std::string(symbol);
|
std::string name = std::string(symbol);
|
||||||
|
|
||||||
iJIT_Method_Load ml;
|
iJIT_Method_Load ml;
|
||||||
|
@ -114,8 +117,10 @@ void InfoVector::map(uptr x86, u32 size, const char *symbol)
|
||||||
ml.method_size = size;
|
ml.method_size = size;
|
||||||
|
|
||||||
iJIT_NotifyEvent(iJVM_EVENT_TYPE_METHOD_LOAD_FINISHED, &ml);
|
iJIT_NotifyEvent(iJVM_EVENT_TYPE_METHOD_LOAD_FINISHED, &ml);
|
||||||
}
|
|
||||||
|
//fprintf(stderr, "mapF %s: %p size %dKB\n", ml.method_name, ml.method_load_address, ml.method_size / 1024u);
|
||||||
#endif
|
#endif
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void InfoVector::map(uptr x86, u32 size, u32 pc)
|
void InfoVector::map(uptr x86, u32 size, u32 pc)
|
||||||
|
@ -125,19 +130,24 @@ void InfoVector::map(uptr x86, u32 size, u32 pc)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef ENABLE_VTUNE
|
#ifdef ENABLE_VTUNE
|
||||||
std::string name = std::string(m_prefix) + "_" + std::to_string(pc);
|
iJIT_Method_Load_V2 ml;
|
||||||
//fprintf(stderr, "map %s: %p size %d\n", name.c_str(), (void*)x86, size);
|
|
||||||
|
|
||||||
iJIT_Method_Load ml;
|
|
||||||
|
|
||||||
memset(&ml, 0, sizeof(ml));
|
memset(&ml, 0, sizeof(ml));
|
||||||
|
|
||||||
|
#ifdef MERGE_BLOCK_RESULT
|
||||||
|
ml.method_id = m_vtune_id;
|
||||||
|
ml.method_name = m_prefix;
|
||||||
|
#else
|
||||||
|
std::string name = std::string(m_prefix) + "_" + std::to_string(pc);
|
||||||
ml.method_id = iJIT_GetNewMethodID();
|
ml.method_id = iJIT_GetNewMethodID();
|
||||||
ml.method_name = (char *)name.c_str();
|
ml.method_name = (char *)name.c_str();
|
||||||
|
#endif
|
||||||
ml.method_load_address = (void *)x86;
|
ml.method_load_address = (void *)x86;
|
||||||
ml.method_size = size;
|
ml.method_size = size;
|
||||||
|
|
||||||
iJIT_NotifyEvent(iJVM_EVENT_TYPE_METHOD_LOAD_FINISHED, &ml);
|
iJIT_NotifyEvent(iJVM_EVENT_TYPE_METHOD_LOAD_FINISHED_V2, &ml);
|
||||||
|
|
||||||
|
//fprintf(stderr, "mapB %s: %p size %d\n", ml.method_name, ml.method_load_address, ml.method_size);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue