diff options
author | Brian Robbins <brianrob@microsoft.com> | 2017-05-15 08:15:51 -0700 |
---|---|---|
committer | Vance Morrison <vancem@microsoft.com> | 2017-05-15 08:15:51 -0700 |
commit | 1cf39a4e686668f35aec3f336615c422e3cc9fec (patch) | |
tree | 5185983d205285e8093cf4d3b483725d72359338 /src/vm/sampleprofiler.cpp | |
parent | f11f3d73eb432b1dc4c42df6eb1e1fb099222730 (diff) | |
download | coreclr-1cf39a4e686668f35aec3f336615c422e3cc9fec.tar.gz coreclr-1cf39a4e686668f35aec3f336615c422e3cc9fec.tar.bz2 coreclr-1cf39a4e686668f35aec3f336615c422e3cc9fec.zip |
Allow coniguration of sampling rate. (#11595)
Diffstat (limited to 'src/vm/sampleprofiler.cpp')
-rw-r--r-- | src/vm/sampleprofiler.cpp | 16 |
1 files changed, 6 insertions, 10 deletions
diff --git a/src/vm/sampleprofiler.cpp b/src/vm/sampleprofiler.cpp index 7c6429a211..3ed1a5b7fd 100644 --- a/src/vm/sampleprofiler.cpp +++ b/src/vm/sampleprofiler.cpp @@ -17,9 +17,7 @@ const GUID SampleProfiler::s_providerID = {0x3c530d44,0x97ae,0x513a,{0x1e,0x6d,0 EventPipeProvider* SampleProfiler::s_pEventPipeProvider = NULL; EventPipeEvent* SampleProfiler::s_pThreadTimeEvent = NULL; CLREventStatic SampleProfiler::s_threadShutdownEvent; -#ifdef FEATURE_PAL long SampleProfiler::s_samplingRateInNs = 1000000; // 1ms -#endif void SampleProfiler::Enable() { @@ -88,6 +86,12 @@ void SampleProfiler::Disable() s_threadShutdownEvent.Wait(0, FALSE /* bAlertable */); } +void SampleProfiler::SetSamplingRate(long nanoseconds) +{ + LIMITED_METHOD_CONTRACT; + s_samplingRateInNs = nanoseconds; +} + DWORD WINAPI SampleProfiler::ThreadProc(void *args) { CONTRACTL @@ -111,11 +115,7 @@ DWORD WINAPI SampleProfiler::ThreadProc(void *args) if(ThreadSuspend::SysIsSuspendInProgress() || (ThreadSuspend::GetSuspensionThread() != 0)) { // Skip the current sample. -#ifdef FEATURE_PAL PAL_nanosleep(s_samplingRateInNs); -#else - ClrSleepEx(1, FALSE); -#endif continue; } @@ -129,11 +129,7 @@ DWORD WINAPI SampleProfiler::ThreadProc(void *args) ThreadSuspend::RestartEE(FALSE /* bFinishedGC */, TRUE /* SuspendSucceeded */); // Wait until it's time to sample again. -#ifdef FEATURE_PAL PAL_nanosleep(s_samplingRateInNs); -#else - ClrSleepEx(1, FALSE); -#endif } } |