summaryrefslogtreecommitdiff
path: root/src/vm/profilinghelper.h
diff options
context:
space:
mode:
authorDavid Mason <davmason@microsoft.com>2019-05-23 00:19:41 -0700
committerGitHub <noreply@github.com>2019-05-23 00:19:41 -0700
commitbbde6ae7dc9f06201c9bcabd49e790632965227e (patch)
treef08ec37769ad15dcfb4101f7f3152320cfafd0af /src/vm/profilinghelper.h
parent451fd23fa2179fa22c831bcf84edd547bfba5cd9 (diff)
downloadcoreclr-bbde6ae7dc9f06201c9bcabd49e790632965227e.tar.gz
coreclr-bbde6ae7dc9f06201c9bcabd49e790632965227e.tar.bz2
coreclr-bbde6ae7dc9f06201c9bcabd49e790632965227e.zip
Profiler attach over the diagnostics pipe (#24670)
Remove the old windows only profiler attach mechanism and replace it with a cross plat implementation over the diagnostics pipe
Diffstat (limited to 'src/vm/profilinghelper.h')
-rw-r--r--src/vm/profilinghelper.h41
1 files changed, 38 insertions, 3 deletions
diff --git a/src/vm/profilinghelper.h b/src/vm/profilinghelper.h
index 6847a901d2..287c61628a 100644
--- a/src/vm/profilinghelper.h
+++ b/src/vm/profilinghelper.h
@@ -64,9 +64,44 @@ public:
static HRESULT GetCurrentProcessUserSid(PSID * ppsid);
#endif // !FEATURE_PAL
- // helper functions for profiler evacuation counter holder
- static void IncEvacuationCounter(Thread * pThread);
- static void DecEvacuationCounter(Thread * pThread);
+#ifdef FEATURE_PROFAPI_ATTACH_DETACH
+ // ----------------------------------------------------------------------------
+ // ProfilingAPIUtility::IncEvacuationCounter
+ //
+ // Description:
+ // Simple helper to increase the evacuation counter inside an EE thread by one
+ //
+ // Arguments:
+ // * pThread - pointer to an EE Thread
+ //
+ template<typename ThreadType>
+ static FORCEINLINE void IncEvacuationCounter(ThreadType * pThread)
+ {
+ LIMITED_METHOD_CONTRACT;
+
+ if (pThread)
+ pThread->IncProfilerEvacuationCounter();
+ }
+
+ // ----------------------------------------------------------------------------
+ // ProfilingAPIUtility::DecEvacuationCounter
+ //
+ // Description:
+ // Simple helper to decrease the evacuation counter inside an EE thread by one
+ //
+ // Arguments:
+ // * pThread - pointer to an EE Thread
+ //
+ template<typename ThreadType>
+ static FORCEINLINE void DecEvacuationCounter(ThreadType * pThread)
+ {
+ LIMITED_METHOD_CONTRACT;
+
+ if (pThread)
+ pThread->DecProfilerEvacuationCounter();
+ }
+
+#endif // FEATURE_PROFAPI_ATTACH_DETACH
// See code:ProfilingAPIUtility::InitializeProfiling#LoadUnloadCallbackSynchronization
static CRITSEC_COOKIE GetStatusCrst();