summaryrefslogtreecommitdiff
path: root/src/ToolBox/superpmi/superpmi/methodstatsemitter.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/ToolBox/superpmi/superpmi/methodstatsemitter.cpp')
-rw-r--r--src/ToolBox/superpmi/superpmi/methodstatsemitter.cpp42
1 files changed, 22 insertions, 20 deletions
diff --git a/src/ToolBox/superpmi/superpmi/methodstatsemitter.cpp b/src/ToolBox/superpmi/superpmi/methodstatsemitter.cpp
index 5cebc97db4..2ca1adf0cf 100644
--- a/src/ToolBox/superpmi/superpmi/methodstatsemitter.cpp
+++ b/src/ToolBox/superpmi/superpmi/methodstatsemitter.cpp
@@ -11,12 +11,13 @@
#include "methodstatsemitter.h"
#include "logging.h"
-MethodStatsEmitter::MethodStatsEmitter(char *nameOfInput)
+MethodStatsEmitter::MethodStatsEmitter(char* nameOfInput)
{
char filename[MAX_PATH + 1];
sprintf_s(filename, MAX_PATH + 1, "%s.stats", nameOfInput);
- hStatsFile = CreateFileA(filename, GENERIC_WRITE, FILE_SHARE_WRITE, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
+ hStatsFile =
+ CreateFileA(filename, GENERIC_WRITE, FILE_SHARE_WRITE, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
if (hStatsFile == INVALID_HANDLE_VALUE)
{
LogError("Failed to open output file '%s'. GetLastError()=%u", filename, GetLastError());
@@ -34,18 +35,18 @@ MethodStatsEmitter::~MethodStatsEmitter()
}
}
-void MethodStatsEmitter::Emit(int methodNumber, MethodContext *mc, ULONGLONG firstTime, ULONGLONG secondTime)
+void MethodStatsEmitter::Emit(int methodNumber, MethodContext* mc, ULONGLONG firstTime, ULONGLONG secondTime)
{
if (hStatsFile != INVALID_HANDLE_VALUE)
{
- //Print the CSV header row
- char rowData[2048];
- DWORD charCount = 0;
+ // Print the CSV header row
+ char rowData[2048];
+ DWORD charCount = 0;
DWORD bytesWritten = 0;
if (strchr(statsTypes, '*') != NULL || strchr(statsTypes, 'h') != NULL || strchr(statsTypes, 'H') != NULL)
{
- //Obtain the method Hash
+ // Obtain the method Hash
char md5Hash[MD5_HASH_BUFFER_SIZE];
if (mc->dumpMethodMD5HashToBuffer(md5Hash, MD5_HASH_BUFFER_SIZE) != MD5_HASH_BUFFER_SIZE)
md5Hash[0] = 0;
@@ -58,32 +59,33 @@ void MethodStatsEmitter::Emit(int methodNumber, MethodContext *mc, ULONGLONG fir
}
if (strchr(statsTypes, '*') != NULL || strchr(statsTypes, 'i') != NULL || strchr(statsTypes, 'I') != NULL)
{
- //Obtain the IL code size for this method
+ // Obtain the IL code size for this method
CORINFO_METHOD_INFO info;
- unsigned flags = 0;
+ unsigned flags = 0;
mc->repCompileMethod(&info, &flags);
charCount += sprintf_s(rowData + charCount, _countof(rowData) - charCount, "%d,", info.ILCodeSize);
}
if (strchr(statsTypes, '*') != NULL || strchr(statsTypes, 'a') != NULL || strchr(statsTypes, 'A') != NULL)
{
- //Obtain the compiled method ASM size
- BYTE *temp;
- DWORD codeSize;
+ // Obtain the compiled method ASM size
+ BYTE* temp;
+ DWORD codeSize;
CorJitResult result;
if (mc->cr->CompileMethod != nullptr)
mc->cr->repCompileMethod(&temp, &codeSize, &result);
else
- codeSize = 0;//this is likely a thin mc
+ codeSize = 0; // this is likely a thin mc
charCount += sprintf_s(rowData + charCount, _countof(rowData) - charCount, "%d,", codeSize);
}
if (strchr(statsTypes, '*') != NULL || strchr(statsTypes, 't') != NULL || strchr(statsTypes, 'T') != NULL)
{
- charCount += sprintf_s(rowData + charCount, _countof(rowData) - charCount, "%llu,%llu,", firstTime, secondTime);
+ charCount +=
+ sprintf_s(rowData + charCount, _countof(rowData) - charCount, "%llu,%llu,", firstTime, secondTime);
}
- //get rid of the final ',' and replace it with a '\n'
+ // get rid of the final ',' and replace it with a '\n'
rowData[charCount - 1] = '\n';
if (!WriteFile(hStatsFile, rowData, charCount, &bytesWritten, nullptr) || bytesWritten != charCount)
@@ -93,15 +95,15 @@ void MethodStatsEmitter::Emit(int methodNumber, MethodContext *mc, ULONGLONG fir
}
}
-void MethodStatsEmitter::SetStatsTypes(char *types)
+void MethodStatsEmitter::SetStatsTypes(char* types)
{
statsTypes = types;
if (hStatsFile != INVALID_HANDLE_VALUE)
{
- //Print the CSV header row
- char rowHeader[1024];
- DWORD charCount = 0;
+ // Print the CSV header row
+ char rowHeader[1024];
+ DWORD charCount = 0;
DWORD bytesWritten = 0;
if (strchr(statsTypes, '*') != NULL || strchr(statsTypes, 'h') != NULL || strchr(statsTypes, 'H') != NULL)
@@ -115,7 +117,7 @@ void MethodStatsEmitter::SetStatsTypes(char *types)
if (strchr(statsTypes, '*') != NULL || strchr(statsTypes, 't') != NULL || strchr(statsTypes, 'T') != NULL)
charCount += sprintf_s(rowHeader + charCount, _countof(rowHeader) - charCount, "Time1,Time2,");
- //get rid of the final ',' and replace it with a '\n'
+ // get rid of the final ',' and replace it with a '\n'
rowHeader[charCount - 1] = '\n';
if (!WriteFile(hStatsFile, rowHeader, charCount, &bytesWritten, nullptr) || bytesWritten != charCount)