diff options
author | Jan Kotas <jkotas@microsoft.com> | 2016-01-31 14:23:12 -0800 |
---|---|---|
committer | Jan Kotas <jkotas@microsoft.com> | 2016-01-31 14:23:12 -0800 |
commit | a7002caf91ce104ef2d5f12fc27544d7a9039abc (patch) | |
tree | d7a3d6d4a56ebd32ecb5554b41d0de4b65ffe146 /src/vm/proftoeeinterfaceimpl.cpp | |
parent | 1765a84c03a37c9bdb7541cb7db49adad5dae6db (diff) | |
parent | 4c375f4ddfb1d35fd57d6f208e9de30350b4dbdd (diff) | |
download | coreclr-a7002caf91ce104ef2d5f12fc27544d7a9039abc.tar.gz coreclr-a7002caf91ce104ef2d5f12fc27544d7a9039abc.tar.bz2 coreclr-a7002caf91ce104ef2d5f12fc27544d7a9039abc.zip |
Merge pull request #2520 from sperling/profiler
Enabling profiling on Unix/OS X
Diffstat (limited to 'src/vm/proftoeeinterfaceimpl.cpp')
-rw-r--r-- | src/vm/proftoeeinterfaceimpl.cpp | 24 |
1 files changed, 15 insertions, 9 deletions
diff --git a/src/vm/proftoeeinterfaceimpl.cpp b/src/vm/proftoeeinterfaceimpl.cpp index 4a31945300..fe091de5d6 100644 --- a/src/vm/proftoeeinterfaceimpl.cpp +++ b/src/vm/proftoeeinterfaceimpl.cpp @@ -1158,6 +1158,7 @@ BOOL HeapWalkHelper(Object * pBO, void * pvContext) } #endif +#ifdef FEATURE_EVENT_TRACE if (s_forcedGCInProgress && ETW_TRACING_CATEGORY_ENABLED(MICROSOFT_WINDOWS_DOTNETRUNTIME_PROVIDER_Context, TRACE_LEVEL_INFORMATION, @@ -1171,6 +1172,7 @@ BOOL HeapWalkHelper(Object * pBO, void * pvContext) (Object **) arrObjRef); } +#endif // FEATURE_EVENT_TRACE // If the data was not allocated on the stack, need to clean it up. if ((arrObjRef != NULL) && !bOnStack) @@ -1307,6 +1309,7 @@ void ScanRootsHelper(Object** ppObject, ScanContext *pSC, uint32_t dwFlags) } #endif +#ifdef FEATURE_EVENT_TRACE // Notify ETW of the root if (s_forcedGCInProgress && ETW_TRACING_CATEGORY_ENABLED(MICROSOFT_WINDOWS_DOTNETRUNTIME_PROVIDER_Context, @@ -1322,6 +1325,7 @@ void ScanRootsHelper(Object** ppObject, ScanContext *pSC, uint32_t dwFlags) dwFlags, // dwGCFlags dwEtwRootFlags); } +#endif // FEATURE_EVENT_TRACE } #endif // defined(GC_PROFILING) || defined(FEATURE_EVENT_TRACE) @@ -4803,11 +4807,15 @@ HRESULT ProfToEEInterfaceImpl::ForceGC() LL_INFO1000, "**PROF: ForceGC.\n")); +#ifdef FEATURE_EVENT_TRACE // This helper, used by ETW and profAPI ensures a managed thread gets created for // this thread before forcing the GC (to work around Jupiter issues where it's // expected this thread is already managed before starting the GC). HRESULT hr = ETW::GCLog::ForceGCForDiagnostics(); - +#else // !FEATURE_EVENT_TRACE + HRESULT hr = E_FAIL; +#endif // FEATURE_EVENT_TRACE + // If a Thread object was just created for this thread, remember the fact that it // was a ForceGC() thread, so we can be more lenient when doing // COR_PRF_CALLBACKSTATE_INCALLBACK later on from other APIs @@ -6810,6 +6818,8 @@ StackWalkAction ProfilerStackWalkCallback(CrawlFrame *pCf, PROFILER_STACK_WALK_D return SWA_ABORT; } +#ifdef _TARGET_X86_ + //--------------------------------------------------------------------------------------- // Normally, calling GetFunction() on the frame is sufficient to ensure // HelperMethodFrames are intialized. However, sometimes we need to be able to specify @@ -6870,8 +6880,6 @@ static BOOL EnsureFrameInitialized(Frame * pFrame) return FALSE; } - -#ifdef _TARGET_X86_ //--------------------------------------------------------------------------------------- // // Implements the COR_PRF_SNAPSHOT_X86_OPTIMIZED algorithm called by DoStackSnapshot. @@ -7223,13 +7231,13 @@ HRESULT ProfToEEInterfaceImpl::DoStackSnapshot(ThreadID thread, return E_NOTIMPL; #endif -#ifndef FEATURE_HIJACK +#if !defined(FEATURE_HIJACK) || !defined(PLATFORM_SUPPORTS_SAFE_THREADSUSPEND) // DoStackSnapshot needs Thread::Suspend/ResumeThread functionality. // On platforms w/o support for these APIs return E_NOTIMPL. return E_NOTIMPL; -#else // FEATURE_HIJACK +#else // !defined(FEATURE_HIJACK) || !defined(PLATFORM_SUPPORTS_SAFE_THREADSUSPEND) CONTRACTL { @@ -7416,7 +7424,7 @@ HRESULT ProfToEEInterfaceImpl::DoStackSnapshot(ThreadID thread, _ASSERTE(!"Profiler trying to walk destroyed thread"); EEPOLICY_HANDLE_FATAL_ERROR(CORPROF_E_STACKSNAPSHOT_INVALID_TGT_THREAD); } - + // Thread::SuspendThread() ensures that no one else should try to suspend us // while we're suspending pThreadToSnapshot. // @@ -7667,7 +7675,7 @@ Cleanup: return hr; -#endif // FEATURE_HIJACK +#endif // !defined(FEATURE_HIJACK) || !defined(PLATFORM_SUPPORTS_SAFE_THREADSUSPEND) } @@ -9065,8 +9073,6 @@ HRESULT ProfToEEInterfaceImpl::EnumNgenModuleMethodsInliningThisMethod( PROFILER_TO_CLR_ENTRYPOINT_SYNC_EX(kP2EETriggers, (LF_CORPROF, LL_INFO1000, "**PROF: EnumNgenModuleMethodsInliningThisMethod.\n")); - typedef DPTR(class MethodDesc) PTR_MethodDesc; - if (ppEnum == NULL) { return E_INVALIDARG; |