Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

StressLogAnalyzer didn't print the number of messages correctly if it exceeded the int range (2 billion). #54832

Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -544,8 +544,8 @@ static LONG s_wrappedWriteThreadCount;

static const LONG MAX_MESSAGE_COUNT = 64 * 1024 * 1024;
static StressThreadAndMsg* s_threadMsgBuf;
static volatile LONG s_msgCount = 0;
static volatile LONG s_totalMsgCount = 0;
static volatile LONGLONG s_msgCount = 0;
static volatile LONGLONG s_totalMsgCount = 0;
static double s_timeFilterStart = 0;
static double s_timeFilterEnd = 0;
static wchar_t* s_outputFileName = nullptr;
Expand Down Expand Up @@ -988,7 +988,7 @@ bool ParseOptions(int argc, wchar_t* argv[])

static void IncludeMessage(uint64_t threadId, StressMsg* msg)
{
LONG msgCount = _InterlockedIncrement(&s_msgCount) - 1;
LONGLONG msgCount = _InterlockedIncrement64(&s_msgCount) - 1;
if (msgCount < MAX_MESSAGE_COUNT)
{
s_threadMsgBuf[msgCount].threadId = threadId;
Expand Down Expand Up @@ -1133,7 +1133,7 @@ DWORD WINAPI ProcessStresslogWorker(LPVOID)
s_threadStressLogDesc[threadStressLogIndex].workFinished = 1;
}

InterlockedAdd(&s_totalMsgCount, totalMsgCount);
InterlockedAdd64(&s_totalMsgCount, totalMsgCount);
InterlockedAdd(&s_wrappedWriteThreadCount, wrappedWriteThreadCount);

return 0;
Expand All @@ -1151,7 +1151,7 @@ static double FindLatestTime(StressLog::StressLogHeader* hdr)
return latestTime;
}

static void PrintFriendlyNumber(int n)
static void PrintFriendlyNumber(LONGLONG n)
{
if (n < 1000)
printf("%d", n);
Expand Down