diff options
author | Sung Yoon Whang <suwhang@microsoft.com> | 2019-02-09 18:25:10 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-02-09 18:25:10 -0800 |
commit | ee8cda063048305e730c92e6899cf0c523fbe483 (patch) | |
tree | 1561313b98a36ead6b80779cf6c23b0f2acf739d /src/vm/eventpipebuffer.cpp | |
parent | 5922bc02cd9e40615ca420ee9847d2cfc3ef834a (diff) | |
download | coreclr-ee8cda063048305e730c92e6899cf0c523fbe483.tar.gz coreclr-ee8cda063048305e730c92e6899cf0c523fbe483.tar.bz2 coreclr-ee8cda063048305e730c92e6899cf0c523fbe483.zip |
Move eventpipe buffer to TLS (#21817)
* start ripping out eventpipe buffer to tls
* can now emit events from gc threads
* cleanup
* more cleanup
* more cleanup
* tested on linux
* Addressing PR comments
* Move things around a bit to build in Linux
* change eventpipe buffer deallocation code
* more cleanup
* this while loop doesnt do anything now
* Fix build
* fixing build
* More cleanup
* more pr comments
* Fix unix build
* more pr comments
* trying to add a message to assertion that seems to be causing CIs to fail
* more pr feedback
* handle non-2-byte aligned string payloads inside payload buffers
* some more cleanup
* Fix off by one error in null index calculation
* Make Get/SetThreadEventBufferList a static member of ThreadEventBufferList
* make only the methods public in ThreadEventBufferList
* Addressing noah's comments
* fix comment and last off by 1 error
Diffstat (limited to 'src/vm/eventpipebuffer.cpp')
-rw-r--r-- | src/vm/eventpipebuffer.cpp | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/vm/eventpipebuffer.cpp b/src/vm/eventpipebuffer.cpp index e7489cd0cd..1149427798 100644 --- a/src/vm/eventpipebuffer.cpp +++ b/src/vm/eventpipebuffer.cpp @@ -54,14 +54,13 @@ bool EventPipeBuffer::WriteEvent(Thread *pThread, EventPipeSession &session, Eve NOTHROW; GC_NOTRIGGER; MODE_ANY; - PRECONDITION(pThread != NULL); PRECONDITION(((size_t)m_pCurrent % AlignmentSize) == 0); } CONTRACTL_END; // Calculate the size of the event. unsigned int eventSize = sizeof(EventPipeEventInstance) + payload.GetSize(); - + // Make sure we have enough space to write the event. if(m_pCurrent + eventSize >= m_pLimit) { @@ -75,14 +74,16 @@ bool EventPipeBuffer::WriteEvent(Thread *pThread, EventPipeSession &session, Eve EX_TRY { // Placement-new the EventPipeEventInstance. + // if pthread is NULL, it's likely we are running in something like a GC thread which is not a Thread object, so it can't have an activity ID set anyway EventPipeEventInstance *pInstance = new (m_pCurrent) EventPipeEventInstance( session, event, - pThread->GetOSThreadId(), + (pThread == NULL) ? ::GetCurrentThreadId() : pThread->GetOSThreadId(), pDataDest, payload.GetSize(), - pActivityId, + (pThread == NULL) ? NULL : pActivityId, pRelatedActivityId); + // Copy the stack if a separate stack trace was provided. if(pStack != NULL) |