From 7ca2692405f255ce4a87d2c3ec263d938cf274fc Mon Sep 17 00:00:00 2001 From: Brian Robbins Date: Thu, 25 May 2017 12:28:24 -0700 Subject: Implement Activity ID / Related Activity ID for EventSources Writing to EventPipe (#11904) * Implement thread-local storage of activity ids. * Plumb the activity id and related activity id into the trace file. --- src/vm/eventpipe.cpp | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) (limited to 'src/vm/eventpipe.cpp') diff --git a/src/vm/eventpipe.cpp b/src/vm/eventpipe.cpp index b73c023b64..4eae6a87c6 100644 --- a/src/vm/eventpipe.cpp +++ b/src/vm/eventpipe.cpp @@ -282,7 +282,7 @@ void EventPipe::DeleteProvider(EventPipeProvider *pProvider) } } -void EventPipe::WriteEvent(EventPipeEvent &event, BYTE *pData, unsigned int length) +void EventPipe::WriteEvent(EventPipeEvent &event, BYTE *pData, unsigned int length, LPCGUID pActivityId, LPCGUID pRelatedActivityId) { CONTRACTL { @@ -309,7 +309,7 @@ void EventPipe::WriteEvent(EventPipeEvent &event, BYTE *pData, unsigned int leng if(!s_pConfig->RundownEnabled() && s_pBufferManager != NULL) { - if(!s_pBufferManager->WriteEvent(pThread, event, pData, length)) + if(!s_pBufferManager->WriteEvent(pThread, event, pData, length, pActivityId, pRelatedActivityId)) { // This is used in DEBUG to make sure that we don't log an event synchronously that we didn't log to the buffer. return; @@ -323,7 +323,9 @@ void EventPipe::WriteEvent(EventPipeEvent &event, BYTE *pData, unsigned int leng event, pThread->GetOSThreadId(), pData, - length); + length, + pActivityId, + pRelatedActivityId); if(s_pFile != NULL) { @@ -340,7 +342,9 @@ void EventPipe::WriteEvent(EventPipeEvent &event, BYTE *pData, unsigned int leng event, pThread->GetOSThreadId(), pData, - length); + length, + pActivityId, + pRelatedActivityId); // Write to the EventPipeFile if it exists. if(s_pSyncFile != NULL) @@ -372,7 +376,7 @@ void EventPipe::WriteSampleProfileEvent(Thread *pSamplingThread, EventPipeEvent { // Specify the sampling thread as the "current thread", so that we select the right buffer. // Specify the target thread so that the event gets properly attributed. - if(!s_pBufferManager->WriteEvent(pSamplingThread, *pEvent, pData, length, pTargetThread, &stackContents)) + if(!s_pBufferManager->WriteEvent(pSamplingThread, *pEvent, pData, length, NULL /* pActivityId */, NULL /* pRelatedActivityId */, pTargetThread, &stackContents)) { // This is used in DEBUG to make sure that we don't log an event synchronously that we didn't log to the buffer. return; @@ -577,14 +581,16 @@ void QCALLTYPE EventPipeInternal::WriteEvent( INT_PTR eventHandle, unsigned int eventID, void *pData, - unsigned int length) + unsigned int length, + LPCGUID pActivityId, + LPCGUID pRelatedActivityId) { QCALL_CONTRACT; BEGIN_QCALL; _ASSERTE(eventHandle != NULL); EventPipeEvent *pEvent = reinterpret_cast(eventHandle); - EventPipe::WriteEvent(*pEvent, (BYTE *)pData, length); + EventPipe::WriteEvent(*pEvent, (BYTE *)pData, length, pActivityId, pRelatedActivityId); END_QCALL; } -- cgit v1.2.3