diff options
author | Jakob Botsch Nielsen <Jakob.botsch.nielsen@gmail.com> | 2021-05-03 15:39:06 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-05-03 15:39:06 +0300 |
commit | dfbe3aeb0941d5498b8c41b830d74b1f96f6f9db (patch) | |
tree | 30546f66502edb054de4b64148187c5cc31b86c8 /src/coreclr/ToolBox | |
parent | 35d886bc9596e08e79a90668ec18456fd99a91b9 (diff) |
Add option to instrument using 64-bit counts (#51625)
Add COMPlus_JitCollect64BitCounts which makes the JIT instrument using
64-bit counts instead of 32-bit counts. No support for consuming these
counts is added, only support for producing them.
I also changed the printing of relocs to include their values when
diffable disassembly is off.
Diffstat (limited to 'src/coreclr/ToolBox')
-rw-r--r-- | src/coreclr/ToolBox/superpmi/superpmi-shared/methodcontext.cpp | 50 |
1 files changed, 35 insertions, 15 deletions
diff --git a/src/coreclr/ToolBox/superpmi/superpmi-shared/methodcontext.cpp b/src/coreclr/ToolBox/superpmi/superpmi-shared/methodcontext.cpp index 791b7f6c5c1..72d8abc1c1d 100644 --- a/src/coreclr/ToolBox/superpmi/superpmi-shared/methodcontext.cpp +++ b/src/coreclr/ToolBox/superpmi/superpmi-shared/methodcontext.cpp @@ -5526,9 +5526,15 @@ void MethodContext::dmpGetPgoInstrumentationResults(DWORDLONG key, const Agnosti case ICorJitInfo::PgoInstrumentationKind::BasicBlockIntCount: printf("B %u", *(unsigned*)(pInstrumentationData + pBuf[i].Offset)); break; + case ICorJitInfo::PgoInstrumentationKind::BasicBlockLongCount: + printf("B %llu", *(uint64_t*)(pInstrumentationData + pBuf[i].Offset)); + break; case ICorJitInfo::PgoInstrumentationKind::EdgeIntCount: printf("E %u", *(unsigned*)(pInstrumentationData + pBuf[i].Offset)); break; + case ICorJitInfo::PgoInstrumentationKind::EdgeLongCount: + printf("E %llu", *(uint64_t*)(pInstrumentationData + pBuf[i].Offset)); + break; case ICorJitInfo::PgoInstrumentationKind::TypeHandleHistogramCount: printf("T %u", *(unsigned*)(pInstrumentationData + pBuf[i].Offset)); break; @@ -6704,28 +6710,40 @@ int MethodContext::dumpMethodIdentityInfoToBuffer(char* buff, int len, bool igno size_t minOffset = (size_t) ~0; size_t maxOffset = 0; - uint32_t totalCount = 0; + uint64_t totalCount = 0; if (SUCCEEDED(pgoHR)) { - // Locate the range of the counter data. + // Locate the range of the data. // for (UINT32 i = 0; i < schemaCount; i++) { - if ((schema[i].InstrumentationKind == ICorJitInfo::PgoInstrumentationKind::BasicBlockIntCount) - || (schema[i].InstrumentationKind == ICorJitInfo::PgoInstrumentationKind::EdgeIntCount)) + size_t start = schema[i].Offset; + size_t end; + switch (schema[i].InstrumentationKind) { - if (schema[i].Offset < minOffset) - { - minOffset = schema[i].Offset; - } + case ICorJitInfo::PgoInstrumentationKind::BasicBlockIntCount: + case ICorJitInfo::PgoInstrumentationKind::EdgeIntCount: + totalCount += *(uint32_t*)(schemaData + schema[i].Offset); + end = start + 4; + break; + case ICorJitInfo::PgoInstrumentationKind::BasicBlockLongCount: + case ICorJitInfo::PgoInstrumentationKind::EdgeLongCount: + totalCount += *(uint64_t*)(schemaData + schema[i].Offset); + end = start + 8; + break; + default: + continue; + } - if (schema[i].Offset > maxOffset) - { - maxOffset = schema[i].Offset; - } + if (start < minOffset) + { + minOffset = start; + } - totalCount += *(uint32_t*)(schemaData + schema[i].Offset); + if (end > maxOffset) + { + maxOffset = end; } } @@ -6734,10 +6752,10 @@ int MethodContext::dumpMethodIdentityInfoToBuffer(char* buff, int len, bool igno if (minOffset < maxOffset) { char pgoHash[MD5_HASH_BUFFER_SIZE]; - dumpMD5HashToBuffer(schemaData + minOffset, (int)(maxOffset + sizeof(int) - minOffset), pgoHash, + dumpMD5HashToBuffer(schemaData + minOffset, (int)(maxOffset - minOffset), pgoHash, MD5_HASH_BUFFER_SIZE); - t = sprintf_s(buff, len, " Pgo Counters %u, Count %u, Hash: %s", schemaCount, totalCount, pgoHash); + t = sprintf_s(buff, len, " Pgo Counters %u, Count %llu, Hash: %s", schemaCount, totalCount, pgoHash); buff += t; len -= t; } @@ -6780,6 +6798,7 @@ bool MethodContext::hasPgoData(bool& hasEdgeProfile, bool& hasClassProfile, bool { hasEdgeProfile = false; hasClassProfile = false; + hasLikelyClass = false; // Obtain the Method Info structure for this method CORINFO_METHOD_INFO info; @@ -6799,6 +6818,7 @@ bool MethodContext::hasPgoData(bool& hasEdgeProfile, bool& hasClassProfile, bool for (UINT32 i = 0; i < schemaCount; i++) { hasEdgeProfile |= (schema[i].InstrumentationKind == ICorJitInfo::PgoInstrumentationKind::EdgeIntCount); + hasEdgeProfile |= (schema[i].InstrumentationKind == ICorJitInfo::PgoInstrumentationKind::EdgeLongCount); hasClassProfile |= (schema[i].InstrumentationKind == ICorJitInfo::PgoInstrumentationKind::TypeHandleHistogramCount); hasLikelyClass |= (schema[i].InstrumentationKind == ICorJitInfo::PgoInstrumentationKind::GetLikelyClass); |