Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches
DataflowEtwProvider.cs
Go to the documentation of this file.
3using System.Linq;
4
6
7[EventSource(Name = "System.Threading.Tasks.Dataflow.DataflowEventSource", Guid = "16F53577-E41D-43D4-B47E-C17025BF4025", LocalizationResources = "FxResources.System.Threading.Tasks.Dataflow.SR")]
8internal sealed class DataflowEtwProvider : EventSource
9{
15
17 {
19 Faulted = 7,
20 Canceled = 6
21 }
22
23 internal static readonly DataflowEtwProvider Log = new DataflowEtwProvider();
24
26 {
27 }
28
29 [NonEvent]
30 internal void DataflowBlockCreated(IDataflowBlock block, DataflowBlockOptions dataflowBlockOptions)
31 {
32 if (IsEnabled(EventLevel.Informational, EventKeywords.All))
33 {
34 DataflowBlockCreated(Common.GetNameForDebugger(block, dataflowBlockOptions), Common.GetBlockId(block));
35 }
36 }
37
38 [Event(1, Level = EventLevel.Informational)]
39 private void DataflowBlockCreated(string blockName, int blockId)
40 {
41 WriteEvent(1, blockName, blockId);
42 }
43
44 [NonEvent]
45 internal void TaskLaunchedForMessageHandling(IDataflowBlock block, Task task, TaskLaunchedReason reason, int availableMessages)
46 {
47 if (IsEnabled(EventLevel.Informational, EventKeywords.All))
48 {
49 TaskLaunchedForMessageHandling(Common.GetBlockId(block), reason, availableMessages, task.Id);
50 }
51 }
52
53 [UnconditionalSuppressMessage("ReflectionAnalysis", "IL2026:RequiresUnreferencedCode", Justification = "WriteEvent Parameters are trimmer safe")]
54 [Event(2, Level = EventLevel.Informational)]
55 private void TaskLaunchedForMessageHandling(int blockId, TaskLaunchedReason reason, int availableMessages, int taskId)
56 {
57 WriteEvent(2, blockId, reason, availableMessages, taskId);
58 }
59
60 [NonEvent]
62 {
63 if (!IsEnabled(EventLevel.Informational, EventKeywords.All))
64 {
65 return;
66 }
67 Task potentiallyNotSupportedCompletionTask = Common.GetPotentiallyNotSupportedCompletionTask(block);
68 if (potentiallyNotSupportedCompletionTask == null || !potentiallyNotSupportedCompletionTask.IsCompleted)
69 {
70 return;
71 }
72 BlockCompletionReason status = (BlockCompletionReason)potentiallyNotSupportedCompletionTask.Status;
73 string exceptionData = string.Empty;
74 if (potentiallyNotSupportedCompletionTask.IsFaulted)
75 {
76 try
77 {
78 exceptionData = string.Join(Environment.NewLine, potentiallyNotSupportedCompletionTask.Exception.InnerExceptions.Select((Exception e) => e.ToString()));
79 }
80 catch
81 {
82 }
83 }
84 DataflowBlockCompleted(Common.GetBlockId(block), status, exceptionData);
85 }
86
87 [UnconditionalSuppressMessage("ReflectionAnalysis", "IL2026:RequiresUnreferencedCode", Justification = "WriteEvent Parameters are trimmer safe")]
88 [Event(3, Level = EventLevel.Informational)]
89 private void DataflowBlockCompleted(int blockId, BlockCompletionReason reason, string exceptionData)
90 {
91 WriteEvent(3, blockId, reason, exceptionData);
92 }
93
94 [NonEvent]
96 {
97 if (IsEnabled(EventLevel.Informational, EventKeywords.All))
98 {
100 }
101 }
102
103 [Event(4, Level = EventLevel.Informational)]
104 private void DataflowBlockLinking(int sourceId, int targetId)
105 {
106 WriteEvent(4, sourceId, targetId);
107 }
108
109 [NonEvent]
111 {
112 if (IsEnabled(EventLevel.Informational, EventKeywords.All))
113 {
115 }
116 }
117
118 [Event(5, Level = EventLevel.Informational)]
119 private void DataflowBlockUnlinking(int sourceId, int targetId)
120 {
121 WriteEvent(5, sourceId, targetId);
122 }
123}
ReadOnlyCollection< Exception > InnerExceptions
unsafe void WriteEvent(int eventId)
static string NewLine
override string ToString()
Definition Exception.cs:384
static Task GetPotentiallyNotSupportedCompletionTask(IDataflowBlock block)
Definition Common.cs:232
static string GetNameForDebugger(IDataflowBlock block, DataflowBlockOptions options=null)
Definition Common.cs:66
static int GetBlockId(IDataflowBlock block)
Definition Common.cs:61
void DataflowBlockCompleted(int blockId, BlockCompletionReason reason, string exceptionData)
void TaskLaunchedForMessageHandling(int blockId, TaskLaunchedReason reason, int availableMessages, int taskId)
void DataflowBlockUnlinking< T >(ISourceBlock< T > source, ITargetBlock< T > target)
void DataflowBlockLinking< T >(ISourceBlock< T > source, ITargetBlock< T > target)
void TaskLaunchedForMessageHandling(IDataflowBlock block, Task task, TaskLaunchedReason reason, int availableMessages)
void DataflowBlockCreated(IDataflowBlock block, DataflowBlockOptions dataflowBlockOptions)
AggregateException? Exception
Definition Task.cs:1014