Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches

◆ Enable() [2/2]

static unsafe ulong System.Diagnostics.Tracing.EventPipeInternal.Enable ( string outputFile,
EventPipeSerializationFormat format,
uint circularBufferSizeInMB,
EventPipeProviderConfiguration[] providers )
inlinestaticpackage

Definition at line 71 of file EventPipeInternal.cs.

72 {
73 Span<EventPipeProviderConfigurationNative> span = new Span<EventPipeProviderConfigurationNative>((void*)Marshal.AllocCoTaskMem(sizeof(EventPipeProviderConfigurationNative) * providers.Length), providers.Length);
74 span.Clear();
75 try
76 {
77 for (int i = 0; i < providers.Length; i++)
78 {
79 EventPipeProviderConfigurationNative.MarshalToNative(providers[i], ref span[i]);
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 {
97 Marshal.FreeCoTaskMem((IntPtr)ptr);
98 }
99 }
100 }
static void FreeCoTaskMem(IntPtr ptr)
Definition Marshal.cs:1712
static IntPtr AllocCoTaskMem(int cb)
Definition Marshal.cs:1702

References System.Runtime.InteropServices.Marshal.AllocCoTaskMem(), System.Span< T >.Clear(), System.Diagnostics.Tracing.Enable, System.format, System.Runtime.InteropServices.Marshal.FreeCoTaskMem(), System.Span< T >.Length, and System.Diagnostics.Tracing.EventPipeInternal.EventPipeProviderConfigurationNative.MarshalToNative().