summaryrefslogtreecommitdiff
path: root/src/vm/eventpipeeventinstance.cpp
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/eventpipeeventinstance.cpp
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/eventpipeeventinstance.cpp')
-rw-r--r--src/vm/eventpipeeventinstance.cpp45
1 files changed, 45 insertions, 0 deletions
diff --git a/src/vm/eventpipeeventinstance.cpp b/src/vm/eventpipeeventinstance.cpp
index 2bf500be70..7877b797b1 100644
--- a/src/vm/eventpipeeventinstance.cpp
+++ b/src/vm/eventpipeeventinstance.cpp
@@ -24,6 +24,10 @@ EventPipeEventInstance::EventPipeEventInstance(
}
CONTRACTL_END;
+#ifdef _DEBUG
+ m_debugEventStart = 0xDEADBEEF;
+ m_debugEventEnd = 0xCAFEBABE;
+#endif // _DEBUG
m_pEvent = &event;
m_threadID = threadID;
m_pData = pData;
@@ -34,6 +38,10 @@ EventPipeEventInstance::EventPipeEventInstance(
{
EventPipe::WalkManagedStackForCurrentThread(m_stackContents);
}
+
+#ifdef _DEBUG
+ EnsureConsistency();
+#endif // _DEBUG
}
StackContents* EventPipeEventInstance::GetStack()
@@ -50,6 +58,13 @@ EventPipeEvent* EventPipeEventInstance::GetEvent() const
return m_pEvent;
}
+LARGE_INTEGER EventPipeEventInstance::GetTimeStamp() const
+{
+ LIMITED_METHOD_CONTRACT;
+
+ return m_timeStamp;
+}
+
BYTE* EventPipeEventInstance::GetData() const
{
LIMITED_METHOD_CONTRACT;
@@ -113,6 +128,7 @@ void EventPipeEventInstance::FastSerialize(FastSerializer *pSerializer, StreamLa
}
}
+#ifdef _DEBUG
void EventPipeEventInstance::SerializeToJsonFile(EventPipeJsonFile *pFile)
{
CONTRACTL
@@ -147,6 +163,35 @@ void EventPipeEventInstance::SerializeToJsonFile(EventPipeJsonFile *pFile)
}
EX_CATCH{} EX_END_CATCH(SwallowAllExceptions);
}
+#endif
+
+void EventPipeEventInstance::SetTimeStamp(LARGE_INTEGER timeStamp)
+{
+ LIMITED_METHOD_CONTRACT;
+
+ m_timeStamp = timeStamp;
+}
+
+#ifdef _DEBUG
+bool EventPipeEventInstance::EnsureConsistency()
+{
+ CONTRACTL
+ {
+ NOTHROW;
+ GC_NOTRIGGER;
+ MODE_ANY;
+ }
+ CONTRACTL_END;
+
+ // Validate event start.
+ _ASSERTE(m_debugEventStart == 0xDEADBEEF);
+
+ // Validate event end.
+ _ASSERTE(m_debugEventEnd == 0xCAFEBABE);
+
+ return true;
+}
+#endif // _DEBUG
SampleProfilerEventInstance::SampleProfilerEventInstance(Thread *pThread)
:EventPipeEventInstance(*SampleProfiler::s_pThreadTimeEvent, pThread->GetOSThreadId(), NULL, 0)