Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches
ArrayPoolEventSource.cs
Go to the documentation of this file.
3
4namespace System.Buffers;
5
6[EventSource(Guid = "0866B2B8-5CEF-5DB9-2612-0C0FFD814A44", Name = "System.Buffers.ArrayPoolEventSource")]
7internal sealed class ArrayPoolEventSource : EventSource
8{
10 {
11 Pooled,
14 }
15
16 internal enum BufferDroppedReason
17 {
18 Full,
20 }
21
22 private const string EventSourceSuppressMessage = "Parameters to this method are primitive and are trimmer safe";
23
24 internal static readonly ArrayPoolEventSource Log = new ArrayPoolEventSource();
25
26 internal const int NoBucketId = -1;
27
28 private protected override ReadOnlySpan<byte> ProviderMetadata => new byte[38]
29 {
30 38, 0, 83, 121, 115, 116, 101, 109, 46, 66,
31 117, 102, 102, 101, 114, 115, 46, 65, 114, 114,
32 97, 121, 80, 111, 111, 108, 69, 118, 101, 110,
33 116, 83, 111, 117, 114, 99, 101, 0
34 };
35
36 private ArrayPoolEventSource(int _)
37 {
38 }
39
40 [UnconditionalSuppressMessage("ReflectionAnalysis", "IL2026:UnrecognizedReflectionPattern", Justification = "Parameters to this method are primitive and are trimmer safe")]
41 [Event(1, Level = EventLevel.Verbose)]
42 internal unsafe void BufferRented(int bufferId, int bufferSize, int poolId, int bucketId)
43 {
44 EventData* ptr = stackalloc EventData[4];
45 ptr->Size = 4;
46 ptr->DataPointer = (IntPtr)(&bufferId);
47 ptr->Reserved = 0;
48 ptr[1].Size = 4;
49 ptr[1].DataPointer = (IntPtr)(&bufferSize);
50 ptr[1].Reserved = 0;
51 ptr[2].Size = 4;
52 ptr[2].DataPointer = (IntPtr)(&poolId);
53 ptr[2].Reserved = 0;
54 ptr[3].Size = 4;
55 ptr[3].DataPointer = (IntPtr)(&bucketId);
56 ptr[3].Reserved = 0;
57 WriteEventCore(1, 4, ptr);
58 }
59
60 [UnconditionalSuppressMessage("ReflectionAnalysis", "IL2026:UnrecognizedReflectionPattern", Justification = "Parameters to this method are primitive and are trimmer safe")]
61 [Event(2, Level = EventLevel.Informational)]
62 internal unsafe void BufferAllocated(int bufferId, int bufferSize, int poolId, int bucketId, BufferAllocatedReason reason)
63 {
64 EventData* ptr = stackalloc EventData[5];
65 ptr->Size = 4;
66 ptr->DataPointer = (IntPtr)(&bufferId);
67 ptr->Reserved = 0;
68 ptr[1].Size = 4;
69 ptr[1].DataPointer = (IntPtr)(&bufferSize);
70 ptr[1].Reserved = 0;
71 ptr[2].Size = 4;
72 ptr[2].DataPointer = (IntPtr)(&poolId);
73 ptr[2].Reserved = 0;
74 ptr[3].Size = 4;
75 ptr[3].DataPointer = (IntPtr)(&bucketId);
76 ptr[3].Reserved = 0;
77 ptr[4].Size = 4;
78 ptr[4].DataPointer = (IntPtr)(&reason);
79 ptr[4].Reserved = 0;
80 WriteEventCore(2, 5, ptr);
81 }
82
83 [Event(3, Level = EventLevel.Verbose)]
84 internal void BufferReturned(int bufferId, int bufferSize, int poolId)
85 {
86 WriteEvent(3, bufferId, bufferSize, poolId);
87 }
88
89 [Event(4, Level = EventLevel.Informational)]
90 internal void BufferTrimmed(int bufferId, int bufferSize, int poolId)
91 {
92 WriteEvent(4, bufferId, bufferSize, poolId);
93 }
94
95 [Event(5, Level = EventLevel.Informational)]
96 internal void BufferTrimPoll(int milliseconds, int pressure)
97 {
98 WriteEvent(5, milliseconds, pressure);
99 }
100
101 [UnconditionalSuppressMessage("ReflectionAnalysis", "IL2026:RequiresUnreferencedCode", Justification = "Parameters to this method are primitive and are trimmer safe")]
102 [Event(6, Level = EventLevel.Informational)]
103 internal unsafe void BufferDropped(int bufferId, int bufferSize, int poolId, int bucketId, BufferDroppedReason reason)
104 {
105 EventData* ptr = stackalloc EventData[5];
106 ptr->Size = 4;
107 ptr->DataPointer = (IntPtr)(&bufferId);
108 ptr->Reserved = 0;
109 ptr[1].Size = 4;
110 ptr[1].DataPointer = (IntPtr)(&bufferSize);
111 ptr[1].Reserved = 0;
112 ptr[2].Size = 4;
113 ptr[2].DataPointer = (IntPtr)(&poolId);
114 ptr[2].Reserved = 0;
115 ptr[3].Size = 4;
116 ptr[3].DataPointer = (IntPtr)(&bucketId);
117 ptr[3].Reserved = 0;
118 ptr[4].Size = 4;
119 ptr[4].DataPointer = (IntPtr)(&reason);
120 ptr[4].Reserved = 0;
121 WriteEventCore(6, 5, ptr);
122 }
123
125 : base(new Guid(140948152, 23791, 23993, 38, 18, 12, 15, 253, 129, 74, 68), "System.Buffers.ArrayPoolEventSource")
126 {
127 }
128}
void BufferTrimPoll(int milliseconds, int pressure)
unsafe void BufferRented(int bufferId, int bufferSize, int poolId, int bucketId)
unsafe void BufferDropped(int bufferId, int bufferSize, int poolId, int bucketId, BufferDroppedReason reason)
void BufferReturned(int bufferId, int bufferSize, int poolId)
void BufferTrimmed(int bufferId, int bufferSize, int poolId)
static readonly ArrayPoolEventSource Log
unsafe void BufferAllocated(int bufferId, int bufferSize, int poolId, int bucketId, BufferAllocatedReason reason)
override ReadOnlySpan< byte > ProviderMetadata
unsafe void WriteEventCore(int eventId, int eventDataCount, EventData *data)
unsafe void WriteEvent(int eventId)