Skip to content
This repository was archived by the owner on Jan 23, 2023. It is now read-only.
Merged
Changes from all commits
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
13 changes: 13 additions & 0 deletions src/jit/compiler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6575,6 +6575,7 @@ void JitTimer::PrintCsvHeader()
// Ex: ngen install mscorlib won't print stats for "ngen" but for "mscorsvw"
FILE* fp = _wfopen(jitTimeLogCsv, W("w"));
fprintf(fp, "\"Method Name\",");
fprintf(fp, "\"Method Index\",");
fprintf(fp, "\"IL Bytes\",");
fprintf(fp, "\"Basic Blocks\",");
fprintf(fp, "\"Opt Level\",");
Expand All @@ -6590,6 +6591,8 @@ void JitTimer::PrintCsvHeader()
}
}

extern ICorJitHost* g_jitHost;

void JitTimer::PrintCsvMethodStats(Compiler* comp)
{
LPCWSTR jitTimeLogCsv = Compiler::JitTimeLogCsv();
Expand All @@ -6601,10 +6604,20 @@ void JitTimer::PrintCsvMethodStats(Compiler* comp)
// eeGetMethodFullName uses locks, so don't enter crit sec before this call.
const char* methName = comp->eeGetMethodFullName(comp->info.compMethodHnd);

// Try and access the SPMI index to report in the data set.
//
// If the jit is not hosted under SPMI this will return the
// default value of zero.
//
// Query the jit host directly here instead of going via the
// config cache, since value will change for each method.
int index = g_jitHost->getIntConfigValue(W("SuperPMIMethodContextNumber"), 0);

CritSecHolder csvLock(s_csvLock);

FILE* fp = _wfopen(jitTimeLogCsv, W("a"));
fprintf(fp, "\"%s\",", methName);
fprintf(fp, "%d,", index);
fprintf(fp, "%u,", comp->info.compILCodeSize);
fprintf(fp, "%u,", comp->fgBBcount);
fprintf(fp, "%u,", comp->opts.MinOpts());
Expand Down