summaryrefslogtreecommitdiff
path: root/src/vm/eventpipe.h
diff options
context:
space:
mode:
authorBrian Robbins <brianrob@microsoft.com>2017-05-12 10:51:31 -0700
committerGitHub <noreply@github.com>2017-05-12 10:51:31 -0700
commitfca97d0ca72524b3bdd61817f7a172dd47d53287 (patch)
tree2cd8ca575969c94f487e7e9d175099b31fcf6ff6 /src/vm/eventpipe.h
parentf70698458849e3541dc96fac8d6c0d6b52ccf048 (diff)
downloadcoreclr-fca97d0ca72524b3bdd61817f7a172dd47d53287.tar.gz
coreclr-fca97d0ca72524b3bdd61817f7a172dd47d53287.tar.bz2
coreclr-fca97d0ca72524b3bdd61817f7a172dd47d53287.zip
EventPipe Circular Buffer Support and Ability to Start/Stop Tracing (#11507)
Diffstat (limited to 'src/vm/eventpipe.h')
-rw-r--r--src/vm/eventpipe.h71
1 files changed, 69 insertions, 2 deletions
diff --git a/src/vm/eventpipe.h b/src/vm/eventpipe.h
index d5b85f7e3a..626c4dff53 100644
--- a/src/vm/eventpipe.h
+++ b/src/vm/eventpipe.h
@@ -15,6 +15,8 @@ class EventPipeConfiguration;
class EventPipeEvent;
class EventPipeFile;
class EventPipeJsonFile;
+class EventPipeBuffer;
+class EventPipeBufferManager;
class MethodDesc;
class SampleProfilerEventInstance;
@@ -28,9 +30,11 @@ private:
// Top of stack is at index 0.
UINT_PTR m_stackFrames[MAX_STACK_DEPTH];
+#ifdef _DEBUG
// Parallel array of MethodDesc pointers.
// Used for debug-only stack printing.
MethodDesc* m_methods[MAX_STACK_DEPTH];
+#endif // _DEBUG
// The next available slot in StackFrames.
unsigned int m_nextAvailableFrame;
@@ -44,6 +48,18 @@ public:
Reset();
}
+ void CopyTo(StackContents *pDest)
+ {
+ LIMITED_METHOD_CONTRACT;
+ _ASSERTE(pDest != NULL);
+
+ memcpy_s(pDest->m_stackFrames, MAX_STACK_DEPTH * sizeof(UINT_PTR), m_stackFrames, sizeof(UINT_PTR) * m_nextAvailableFrame);
+#ifdef _DEBUG
+ memcpy_s(pDest->m_methods, MAX_STACK_DEPTH * sizeof(MethodDesc*), m_methods, sizeof(MethodDesc*) * m_nextAvailableFrame);
+#endif
+ pDest->m_nextAvailableFrame = m_nextAvailableFrame;
+ }
+
void Reset()
{
LIMITED_METHOD_CONTRACT;
@@ -78,6 +94,7 @@ public:
return m_stackFrames[frameIndex];
}
+#ifdef _DEBUG
MethodDesc* GetMethod(unsigned int frameIndex)
{
LIMITED_METHOD_CONTRACT;
@@ -90,6 +107,7 @@ public:
return m_methods[frameIndex];
}
+#endif // _DEBUG
void Append(UINT_PTR controlPC, MethodDesc *pMethod)
{
@@ -98,7 +116,9 @@ public:
if(m_nextAvailableFrame < MAX_STACK_DEPTH)
{
m_stackFrames[m_nextAvailableFrame] = controlPC;
+#ifdef _DEBUG
m_methods[m_nextAvailableFrame] = pMethod;
+#endif
m_nextAvailableFrame++;
}
}
@@ -124,6 +144,7 @@ class EventPipe
friend class EventPipeConfiguration;
friend class EventPipeFile;
friend class EventPipeProvider;
+ friend class EventPipeBufferManager;
friend class SampleProfiler;
public:
@@ -138,7 +159,11 @@ class EventPipe
static void EnableOnStartup();
// Enable tracing via the event pipe.
- static void Enable();
+ static void Enable(
+ LPCWSTR strOutputPath,
+ uint circularBufferSizeInMB,
+ EventPipeProviderConfiguration *pProviders,
+ int numProviders);
// Disable tracing via the event pipe.
static void Disable();
@@ -148,7 +173,7 @@ class EventPipe
static void WriteEvent(EventPipeEvent &event, BYTE *pData, unsigned int length);
// Write out a sample profile event.
- static void WriteSampleProfileEvent(SampleProfilerEventInstance &instance);
+ static void WriteSampleProfileEvent(Thread *pSamplingThread, Thread *pTargetThread, StackContents &stackContents);
// Get the managed call stack for the current thread.
static bool WalkManagedStackForCurrentThread(StackContents &stackContents);
@@ -171,8 +196,42 @@ class EventPipe
static CrstStatic s_configCrst;
static bool s_tracingInitialized;
static EventPipeConfiguration *s_pConfig;
+ static EventPipeBufferManager *s_pBufferManager;
static EventPipeFile *s_pFile;
+#ifdef _DEBUG
+ static EventPipeFile *s_pSyncFile;
static EventPipeJsonFile *s_pJsonFile;
+#endif // _DEBUG
+};
+
+struct EventPipeProviderConfiguration
+{
+
+private:
+
+ LPCWSTR m_pProviderName;
+ UINT64 m_keywords;
+ unsigned int m_loggingLevel;
+
+public:
+
+ LPCWSTR GetProviderName() const
+ {
+ LIMITED_METHOD_CONTRACT;
+ return m_pProviderName;
+ }
+
+ UINT64 GetKeywords() const
+ {
+ LIMITED_METHOD_CONTRACT;
+ return m_keywords;
+ }
+
+ unsigned int GetLevel() const
+ {
+ LIMITED_METHOD_CONTRACT;
+ return m_loggingLevel;
+ }
};
class EventPipeInternal
@@ -180,6 +239,14 @@ class EventPipeInternal
public:
+ static void QCALLTYPE Enable(
+ __in_z LPCWSTR outputFile,
+ unsigned int circularBufferSizeInMB,
+ EventPipeProviderConfiguration *pProviders,
+ int numProviders);
+
+ static void QCALLTYPE Disable();
+
static INT_PTR QCALLTYPE CreateProvider(
GUID providerID,
EventPipeCallback pCallbackFunc);