Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Clean up perfmap.cpp
  • Loading branch information
jkoritzinsky committed Jun 24, 2022
commit 2edf57ebe06036bbc2aa2a875f1a9ff96f5f793b
20 changes: 7 additions & 13 deletions src/coreclr/vm/perfmap.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -160,8 +160,7 @@ void PerfMap::WriteLine(SString& line)
{
// Write the line.
// The PAL already takes a lock when writing, so we don't need to do so here.
StackScratchBuffer scratch;
const char * strLine = line.GetANSI(scratch);
const char * strLine = line.GetUTF8();
ULONG inCount = line.GetCount();
ULONG outCount;
m_FileStream->Write(strLine, inCount, &outCount);
Expand Down Expand Up @@ -203,17 +202,16 @@ void PerfMap::LogMethod(MethodDesc * pMethod, PCODE pCode, size_t codeSize, cons
pMethod->GetFullMethodInfo(name);

// Build the map file line.
StackScratchBuffer scratch;
if (optimizationTier != nullptr && s_ShowOptimizationTiers)
{
name.AppendPrintf("[%s]", optimizationTier);
}
SString line;
line.Printf(FMT_CODE_ADDR " %x %s\n", pCode, codeSize, name.GetANSI(scratch));
line.Printf(FMT_CODE_ADDR " %x %s\n", pCode, codeSize, name.GetUTF8());

// Write the line.
WriteLine(line);
PAL_PerfJitDump_LogMethod((void*)pCode, codeSize, name.GetANSI(scratch), nullptr, nullptr);
PAL_PerfJitDump_LogMethod((void*)pCode, codeSize, name.GetUTF8(), nullptr, nullptr);
}
EX_CATCH{} EX_END_CATCH(SwallowAllExceptions);
}
Expand Down Expand Up @@ -298,8 +296,6 @@ void PerfMap::LogPreCompiledMethod(MethodDesc * pMethod, PCODE pCode)
SString name;
pMethod->GetFullMethodInfo(name);

StackScratchBuffer scratch;

if (s_ShowOptimizationTiers)
{
name.Append(W("[PreJIT]"));
Expand All @@ -309,7 +305,7 @@ void PerfMap::LogPreCompiledMethod(MethodDesc * pMethod, PCODE pCode)
// Emit an entry for each section if it is used.
if (methodRegionInfo.hotSize > 0)
{
PAL_PerfJitDump_LogMethod((void*)methodRegionInfo.hotStartAddress, methodRegionInfo.hotSize, name.GetANSI(scratch), nullptr, nullptr);
PAL_PerfJitDump_LogMethod((void*)methodRegionInfo.hotStartAddress, methodRegionInfo.hotSize, name.GetUTF8(), nullptr, nullptr);
}

if (methodRegionInfo.coldSize > 0)
Expand All @@ -319,7 +315,7 @@ void PerfMap::LogPreCompiledMethod(MethodDesc * pMethod, PCODE pCode)
pMethod->GetFullMethodInfo(name);
name.Append(W("[PreJit-cold]"));
}
PAL_PerfJitDump_LogMethod((void*)methodRegionInfo.coldStartAddress, methodRegionInfo.coldSize, name.GetANSI(scratch), nullptr, nullptr);
PAL_PerfJitDump_LogMethod((void*)methodRegionInfo.coldStartAddress, methodRegionInfo.coldSize, name.GetUTF8(), nullptr, nullptr);
}
}
EX_CATCH{} EX_END_CATCH(SwallowAllExceptions);
Expand Down Expand Up @@ -348,15 +344,13 @@ void PerfMap::LogStubs(const char* stubType, const char* stubOwner, PCODE pCode,
}

// Build the map file line.
StackScratchBuffer scratch;
SString name;
name.Printf("stub<%d> %s<%s>", ++(s_Current->m_StubsMapped), stubType, stubOwner);
SString line;
line.Printf(FMT_CODE_ADDR " %x %s\n", pCode, codeSize, name.GetANSI(scratch));
line.Printf(FMT_CODE_ADDR " %x %s\n", pCode, codeSize, name.GetUTF8());

// Write the line.
s_Current->WriteLine(line);
PAL_PerfJitDump_LogMethod((void*)pCode, codeSize, name.GetANSI(scratch), nullptr, nullptr);
PAL_PerfJitDump_LogMethod((void*)pCode, codeSize, name.GetUTF8(), nullptr, nullptr);
}
EX_CATCH{} EX_END_CATCH(SwallowAllExceptions);
}
Expand Down