Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches
EventPipeInternal.cs
Go to the documentation of this file.
2
4
5internal static class EventPipeInternal
6{
8 {
9 private unsafe char* m_pProviderName;
10
11 private ulong m_keywords;
12
13 private uint m_loggingLevel;
14
15 private unsafe char* m_pFilterData;
16
18 {
19 native.m_pProviderName = (char*)(void*)Marshal.StringToCoTaskMemUni(managed.ProviderName);
20 native.m_keywords = managed.Keywords;
21 native.m_loggingLevel = managed.LoggingLevel;
22 native.m_pFilterData = (char*)(void*)Marshal.StringToCoTaskMemUni(managed.FilterData);
23 }
24
25 internal unsafe void Release()
26 {
27 if (m_pProviderName != null)
28 {
30 }
31 if (m_pFilterData != null)
32 {
34 }
35 }
36 }
37
38 [DllImport("QCall", CharSet = CharSet.Unicode)]
39 private unsafe static extern ulong Enable(char* outputFile, EventPipeSerializationFormat format, uint circularBufferSizeInMB, EventPipeProviderConfigurationNative* providers, uint numProviders);
40
41 [DllImport("QCall", CharSet = CharSet.Unicode)]
42 internal static extern void Disable(ulong sessionID);
43
44 [DllImport("QCall", CharSet = CharSet.Unicode)]
45 internal static extern IntPtr CreateProvider(string providerName, Interop.Advapi32.EtwEnableCallback callbackFunc);
46
47 [DllImport("QCall", CharSet = CharSet.Unicode)]
48 internal unsafe static extern IntPtr DefineEvent(IntPtr provHandle, uint eventID, long keywords, uint eventVersion, uint level, void* pMetadata, uint metadataLength);
49
50 [DllImport("QCall", CharSet = CharSet.Unicode)]
51 internal static extern IntPtr GetProvider(string providerName);
52
53 [DllImport("QCall", CharSet = CharSet.Unicode)]
54 internal static extern void DeleteProvider(IntPtr provHandle);
55
56 [DllImport("QCall", CharSet = CharSet.Unicode)]
57 internal static extern int EventActivityIdControl(uint controlCode, ref Guid activityId);
58
59 [DllImport("QCall", CharSet = CharSet.Unicode)]
60 internal unsafe static extern void WriteEventData(IntPtr eventHandle, EventProvider.EventData* pEventData, uint dataCount, Guid* activityId, Guid* relatedActivityId);
61
62 [DllImport("QCall", CharSet = CharSet.Unicode)]
63 internal unsafe static extern bool GetSessionInfo(ulong sessionID, EventPipeSessionInfo* pSessionInfo);
64
65 [DllImport("QCall", CharSet = CharSet.Unicode)]
66 internal unsafe static extern bool GetNextEvent(ulong sessionID, EventPipeEventInstanceData* pInstance);
67
68 [DllImport("QCall", CharSet = CharSet.Unicode)]
69 internal static extern IntPtr GetWaitHandle(ulong sessionID);
70
71 internal unsafe static ulong Enable(string outputFile, EventPipeSerializationFormat format, uint circularBufferSizeInMB, EventPipeProviderConfiguration[] providers)
72 {
74 span.Clear();
75 try
76 {
77 for (int i = 0; i < providers.Length; i++)
78 {
80 }
81 fixed (char* outputFile2 = outputFile)
82 {
83 fixed (EventPipeProviderConfigurationNative* providers2 = span)
84 {
85 return Enable(outputFile2, format, circularBufferSizeInMB, providers2, (uint)span.Length);
86 }
87 }
88 }
89 finally
90 {
91 for (int j = 0; j < providers.Length; j++)
92 {
93 span[j].Release();
94 }
95 fixed (EventPipeProviderConfigurationNative* ptr = span)
96 {
98 }
99 }
100 }
101}
unsafe delegate void EtwEnableCallback(in Guid sourceId, int isEnabled, byte level, long matchAnyKeywords, long matchAllKeywords, EVENT_FILTER_DESCRIPTOR *filterData, void *callbackContext)
static unsafe void WriteEventData(IntPtr eventHandle, EventProvider.EventData *pEventData, uint dataCount, Guid *activityId, Guid *relatedActivityId)
static IntPtr GetWaitHandle(ulong sessionID)
static int EventActivityIdControl(uint controlCode, ref Guid activityId)
static unsafe bool GetSessionInfo(ulong sessionID, EventPipeSessionInfo *pSessionInfo)
static IntPtr GetProvider(string providerName)
static void DeleteProvider(IntPtr provHandle)
static unsafe IntPtr DefineEvent(IntPtr provHandle, uint eventID, long keywords, uint eventVersion, uint level, void *pMetadata, uint metadataLength)
static unsafe ulong Enable(char *outputFile, EventPipeSerializationFormat format, uint circularBufferSizeInMB, EventPipeProviderConfigurationNative *providers, uint numProviders)
static unsafe ulong Enable(string outputFile, EventPipeSerializationFormat format, uint circularBufferSizeInMB, EventPipeProviderConfiguration[] providers)
static void Disable(ulong sessionID)
static IntPtr CreateProvider(string providerName, Interop.Advapi32.EtwEnableCallback callbackFunc)
static unsafe bool GetNextEvent(ulong sessionID, EventPipeEventInstanceData *pInstance)
static unsafe IntPtr StringToCoTaskMemUni(string? s)
Definition Marshal.cs:1327
static void FreeCoTaskMem(IntPtr ptr)
Definition Marshal.cs:1712
static IntPtr AllocCoTaskMem(int cb)
Definition Marshal.cs:1702
static unsafe void MarshalToNative(EventPipeProviderConfiguration managed, ref EventPipeProviderConfigurationNative native)
unsafe void Clear()
Definition Span.cs:198
int Length
Definition Span.cs:70