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

◆ OnStart()

void System.Diagnostics.Tracing.ActivityTracker.OnStart ( string providerName,
string activityName,
int task,
ref Guid activityId,
ref Guid relatedActivityId,
EventActivityOptions options,
bool useTplSource = true )
inline

Definition at line 202 of file ActivityTracker.cs.

203 {
204 if (m_current == null)
205 {
207 {
208 return;
209 }
210 m_checkedForEnable = true;
211 if (useTplSource && TplEventSource.Log.IsEnabled(EventLevel.Informational, (EventKeywords)128L))
212 {
213 Enable();
214 }
215 if (m_current == null)
216 {
217 return;
218 }
219 }
220 ActivityInfo value = m_current.Value;
221 string text = NormalizeActivityName(providerName, activityName, task);
222 TplEventSource tplEventSource = (useTplSource ? TplEventSource.Log : null);
223 bool flag = tplEventSource?.Debug ?? false;
224 if (flag)
225 {
226 tplEventSource.DebugFacilityMessage("OnStartEnter", text);
227 tplEventSource.DebugFacilityMessage("OnStartEnterActivityState", ActivityInfo.LiveActivities(value));
228 }
229 if (value != null)
230 {
231 if (value.m_level >= 100)
232 {
233 activityId = Guid.Empty;
234 relatedActivityId = Guid.Empty;
235 if (flag)
236 {
237 tplEventSource.DebugFacilityMessage("OnStartRET", "Fail");
238 }
239 return;
240 }
241 if ((options & EventActivityOptions.Recursive) == 0)
242 {
243 ActivityInfo activityInfo = FindActiveActivity(text, value);
244 if (activityInfo != null)
245 {
246 OnStop(providerName, activityName, task, ref activityId);
247 value = m_current.Value;
248 }
249 }
250 }
251 long uniqueId = ((value != null) ? Interlocked.Increment(ref value.m_lastChildID) : Interlocked.Increment(ref m_nextId));
252 relatedActivityId = EventSource.CurrentThreadActivityId;
253 ActivityInfo activityInfo2 = new ActivityInfo(text, uniqueId, value, relatedActivityId, options);
254 m_current.Value = activityInfo2;
255 activityId = activityInfo2.ActivityId;
256 if (flag)
257 {
258 tplEventSource.DebugFacilityMessage("OnStartRetActivityState", ActivityInfo.LiveActivities(activityInfo2));
259 tplEventSource.DebugFacilityMessage1("OnStartRet", activityId.ToString(), relatedActivityId.ToString());
260 }
261 }
static ActivityInfo FindActiveActivity(string name, ActivityInfo startLocation)
static string NormalizeActivityName(string providerName, string activityName, int task)
void OnStop(string providerName, string activityName, int task, ref Guid activityId, bool useTplSource=true)
static int Increment(ref int location)
void DebugFacilityMessage1(string Facility, string Message, string Value1)
static readonly TplEventSource Log
void DebugFacilityMessage(string Facility, string Message)

References System.Diagnostics.Tracing.ActivityTracker.ActivityInfo.ActivityId, System.Diagnostics.Tracing.EventSource.CurrentThreadActivityId, System.Threading.Tasks.TplEventSource.Debug, System.Threading.Tasks.TplEventSource.DebugFacilityMessage(), System.Threading.Tasks.TplEventSource.DebugFacilityMessage1(), System.Guid.Empty, System.Diagnostics.Tracing.ActivityTracker.Enable(), System.Diagnostics.Tracing.ActivityTracker.FindActiveActivity(), System.Threading.Interlocked.Increment(), System.L, System.Diagnostics.Tracing.ActivityTracker.ActivityInfo.LiveActivities(), System.Threading.Tasks.TplEventSource.Log, System.Diagnostics.Tracing.ActivityTracker.m_checkedForEnable, System.Diagnostics.Tracing.ActivityTracker.m_current, System.Diagnostics.Tracing.ActivityTracker.m_nextId, System.Diagnostics.Tracing.ActivityTracker.NormalizeActivityName(), System.Diagnostics.Tracing.ActivityTracker.OnStop(), System.options, System.task, System.text, and System.value.

Referenced by System.Diagnostics.Tracing.EventSource.WriteEventVarargs(), System.Diagnostics.Tracing.EventSource.WriteEventWithRelatedActivityIdCore(), and System.Diagnostics.Tracing.EventSource.WriteImpl().