diff options
author | José Rivero <jorive@microsoft.com> | 2019-06-14 13:47:04 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-06-14 13:47:04 -0700 |
commit | fc29d38699b8e4ce619d669c2135548fe8abe730 (patch) | |
tree | 37f12f436470dc1710493a740903f0ee77e68168 /src/vm/eventpipeeventpayload.h | |
parent | 54d82b2c1b385025ea84a9fb8c60caa76f371f34 (diff) | |
download | coreclr-fc29d38699b8e4ce619d669c2135548fe8abe730.tar.gz coreclr-fc29d38699b8e4ce619d669c2135548fe8abe730.tar.bz2 coreclr-fc29d38699b8e4ce619d669c2135548fe8abe730.zip |
Moving non-EventPipe types out of eventpipe.* (#25161)
* Replace runtime check with compile time assert.
* Move EventPipeEventPayload to its own file.
* Move `StackContents` to its own file.
* Move other classes declaration/definition out of eventpipe.*
Diffstat (limited to 'src/vm/eventpipeeventpayload.h')
-rw-r--r-- | src/vm/eventpipeeventpayload.h | 80 |
1 files changed, 80 insertions, 0 deletions
diff --git a/src/vm/eventpipeeventpayload.h b/src/vm/eventpipeeventpayload.h new file mode 100644 index 0000000000..0da1e81ab1 --- /dev/null +++ b/src/vm/eventpipeeventpayload.h @@ -0,0 +1,80 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. +// See the LICENSE file in the project root for more information. + +#ifndef __EVENTPIPE_EVENTPAYLOAD_H__ +#define __EVENTPIPE_EVENTPAYLOAD_H__ + +#ifdef FEATURE_PERFTRACING +#include "common.h" + +struct EventData +{ + UINT64 Ptr; + unsigned int Size; + unsigned int Reserved; +}; + +class EventPipeEventPayload +{ +private: + BYTE *m_pData; + EventData *m_pEventData; + unsigned int m_eventDataCount; + unsigned int m_size; + bool m_allocatedData; + + // If the data is stored only as an array of EventData objects, create a flat buffer and copy into it + void Flatten(); + +public: + // Build this payload with a flat buffer inside + EventPipeEventPayload(BYTE *pData, unsigned int length) : + m_pData(pData), + m_pEventData(nullptr), + m_eventDataCount(0), + m_size(length), + m_allocatedData(false) + { + LIMITED_METHOD_CONTRACT; + } + + // Build this payload to contain an array of EventData objects + EventPipeEventPayload(EventData *pEventData, unsigned int eventDataCount); + + // If a buffer was allocated internally, delete it + ~EventPipeEventPayload(); + + // Copy the data (whether flat or array of objects) into a flat buffer at pDst + // Assumes that pDst points to an appropriatly sized buffer + void CopyData(BYTE *pDst); + + // Get the flat formatted data in this payload + // This method will allocate a buffer if it does not already contain flattened data + // This method will return NULL on OOM if a buffer needed to be allocated + BYTE *GetFlatData(); + + // Return true is the data is stored in a flat buffer + bool IsFlattened() const + { + LIMITED_METHOD_CONTRACT; + return m_pData != NULL; + } + + // The the size of buffer needed to contain the stored data + unsigned int GetSize() const + { + LIMITED_METHOD_CONTRACT; + return m_size; + } + + EventData *GetEventDataArray() const + { + LIMITED_METHOD_CONTRACT; + return m_pEventData; + } +}; + +#endif // FEATURE_PERFTRACING + +#endif // __EVENTPIPE_EVENTPAYLOAD_H__ |