blob: 0da1e81ab1027376cdb235cb2483826fb51d28df (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
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__
|