diff options
author | Brian Robbins <brianrob@microsoft.com> | 2018-01-25 20:28:48 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-01-25 20:28:48 -0800 |
commit | 5c5695fb05c62f42b969cc33119399e6c8fcf04e (patch) | |
tree | 751ebbba1af76fa643f2f68ba83ba2d7e7f515a7 /src/vm | |
parent | 145cfe19f9e4f3e8a84b75a3048fe98fffb59a68 (diff) | |
download | coreclr-5c5695fb05c62f42b969cc33119399e6c8fcf04e.tar.gz coreclr-5c5695fb05c62f42b969cc33119399e6c8fcf04e.tar.bz2 coreclr-5c5695fb05c62f42b969cc33119399e6c8fcf04e.zip |
Fix Windows-Specific EventPipe Bugs (#16025)
* Modify IsEnabled macros used on Windows.
* Fix arithmetic error due to order of operations.
Diffstat (limited to 'src/vm')
-rw-r--r-- | src/vm/sampleprofiler.cpp | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/src/vm/sampleprofiler.cpp b/src/vm/sampleprofiler.cpp index ade21669c4..4548620662 100644 --- a/src/vm/sampleprofiler.cpp +++ b/src/vm/sampleprofiler.cpp @@ -15,8 +15,7 @@ #include <mmsystem.h> #endif //FEATURE_PAL -// To avoid counting zeros in conversions -#define MILLION * 1000000 +#define NUM_NANOSECONDS_IN_1_MS (1000000) Volatile<BOOL> SampleProfiler::s_profilingEnabled = false; Thread* SampleProfiler::s_pSamplingThread = NULL; @@ -26,7 +25,7 @@ EventPipeEvent* SampleProfiler::s_pThreadTimeEvent = NULL; BYTE* SampleProfiler::s_pPayloadExternal = NULL; BYTE* SampleProfiler::s_pPayloadManaged = NULL; CLREventStatic SampleProfiler::s_threadShutdownEvent; -unsigned long SampleProfiler::s_samplingRateInNs = 1 MILLION; // 1ms +unsigned long SampleProfiler::s_samplingRateInNs = NUM_NANOSECONDS_IN_1_MS; // 1ms bool SampleProfiler::s_timePeriodIsSet = FALSE; #ifndef FEATURE_PAL @@ -256,7 +255,7 @@ void SampleProfiler::PlatformSleep(unsigned long nanoseconds) #ifdef FEATURE_PAL PAL_nanosleep(nanoseconds); #else //FEATURE_PAL - ClrSleepEx(s_samplingRateInNs / 1 MILLION, FALSE); + ClrSleepEx(s_samplingRateInNs / NUM_NANOSECONDS_IN_1_MS, FALSE); #endif //FEATURE_PAL } @@ -278,7 +277,7 @@ void SampleProfiler::SetTimeGranularity() // the OS is on-CPU, decreasing overall system performance and increasing power consumption if(s_timeBeginPeriodFn != NULL) { - if(((TimePeriodFnPtr) s_timeBeginPeriodFn)(s_samplingRateInNs / 1 MILLION) == TIMERR_NOERROR) + if(((TimePeriodFnPtr) s_timeBeginPeriodFn)(s_samplingRateInNs / NUM_NANOSECONDS_IN_1_MS) == TIMERR_NOERROR) { s_timePeriodIsSet = TRUE; } @@ -300,7 +299,7 @@ void SampleProfiler::ResetTimeGranularity() // End the modifications we had to the timer period in Enable if(s_timeEndPeriodFn != NULL) { - if(((TimePeriodFnPtr) s_timeEndPeriodFn)(s_samplingRateInNs / 1 MILLION) == TIMERR_NOERROR) + if(((TimePeriodFnPtr) s_timeEndPeriodFn)(s_samplingRateInNs / NUM_NANOSECONDS_IN_1_MS) == TIMERR_NOERROR) { s_timePeriodIsSet = FALSE; } |