summaryrefslogtreecommitdiff
path: root/src/vm/proftoeeinterfaceimpl.cpp
diff options
context:
space:
mode:
authorAndreas Strid <andreas_strid@bredband.net>2015-12-21 15:33:18 +0100
committerAndreas Strid <andreas_strid@bredband.net>2016-01-31 17:33:53 +0100
commit4c375f4ddfb1d35fd57d6f208e9de30350b4dbdd (patch)
tree2a4aaff0604b37f4bef68fbef46fe4afd7cbbb79 /src/vm/proftoeeinterfaceimpl.cpp
parent85f256e9b41cac20834d9695675e3ac8694454f9 (diff)
downloadcoreclr-4c375f4ddfb1d35fd57d6f208e9de30350b4dbdd.tar.gz
coreclr-4c375f4ddfb1d35fd57d6f208e9de30350b4dbdd.tar.bz2
coreclr-4c375f4ddfb1d35fd57d6f208e9de30350b4dbdd.zip
Enabling profiling on Unix/OS X.
Diffstat (limited to 'src/vm/proftoeeinterfaceimpl.cpp')
-rw-r--r--src/vm/proftoeeinterfaceimpl.cpp24
1 files changed, 15 insertions, 9 deletions
diff --git a/src/vm/proftoeeinterfaceimpl.cpp b/src/vm/proftoeeinterfaceimpl.cpp
index 0c6e31d482..55ce080ddd 100644
--- a/src/vm/proftoeeinterfaceimpl.cpp
+++ b/src/vm/proftoeeinterfaceimpl.cpp
@@ -1157,6 +1157,7 @@ BOOL HeapWalkHelper(Object * pBO, void * pvContext)
(ObjectID *) arrObjRef);
}
+#ifdef FEATURE_EVENT_TRACE
if (s_forcedGCInProgress &&
ETW_TRACING_CATEGORY_ENABLED(MICROSOFT_WINDOWS_DOTNETRUNTIME_PROVIDER_Context,
TRACE_LEVEL_INFORMATION,
@@ -1170,6 +1171,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)
@@ -1298,6 +1300,7 @@ void ScanRootsHelper(Object** ppObject, ScanContext *pSC, uint32_t dwFlags)
RootReference2((BYTE *)*ppObject, pPSC->dwEtwRootKind, (EtwGCRootFlags)dwEtwRootFlags, (BYTE *)rootID, &((pPSC)->pHeapId));
}
+#ifdef FEATURE_EVENT_TRACE
// Notify ETW of the root
if (s_forcedGCInProgress &&
ETW_TRACING_CATEGORY_ENABLED(MICROSOFT_WINDOWS_DOTNETRUNTIME_PROVIDER_Context,
@@ -1313,6 +1316,7 @@ void ScanRootsHelper(Object** ppObject, ScanContext *pSC, uint32_t dwFlags)
dwFlags, // dwGCFlags
dwEtwRootFlags);
}
+#endif // FEATURE_EVENT_TRACE
}
@@ -4792,11 +4796,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
@@ -6799,6 +6807,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
@@ -6859,8 +6869,6 @@ static BOOL EnsureFrameInitialized(Frame * pFrame)
return FALSE;
}
-
-#ifdef _TARGET_X86_
//---------------------------------------------------------------------------------------
//
// Implements the COR_PRF_SNAPSHOT_X86_OPTIMIZED algorithm called by DoStackSnapshot.
@@ -7212,13 +7220,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
{
@@ -7405,7 +7413,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.
//
@@ -7656,7 +7664,7 @@ Cleanup:
return hr;
-#endif // FEATURE_HIJACK
+#endif // !defined(FEATURE_HIJACK) || !defined(PLATFORM_SUPPORTS_SAFE_THREADSUSPEND)
}
@@ -9054,8 +9062,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;