Beispiel #1
0
        public void OnStart(string providerName, string activityName, int task, ref Guid activityId, ref Guid relatedActivityId, EventActivityOptions options)
        {
            if (this.m_current == null)
            {
                return;
            }
            ActivityTracker.ActivityInfo activityInfo = this.m_current.Value;
            string         str            = this.NormalizeActivityName(providerName, activityName, task);
            TplEtwProvider tplEtwProvider = TplEtwProvider.Log;

            if (tplEtwProvider.Debug)
            {
                tplEtwProvider.DebugFacilityMessage("OnStartEnter", str);
                tplEtwProvider.DebugFacilityMessage("OnStartEnterActivityState", ActivityTracker.ActivityInfo.LiveActivities(activityInfo));
            }
            if (activityInfo != null)
            {
                if (activityInfo.m_level >= 100)
                {
                    activityId        = Guid.Empty;
                    relatedActivityId = Guid.Empty;
                    if (!tplEtwProvider.Debug)
                    {
                        return;
                    }
                    tplEtwProvider.DebugFacilityMessage("OnStartRET", "Fail");
                    return;
                }
                if ((options & EventActivityOptions.Recursive) == EventActivityOptions.None && this.FindActiveActivity(str, activityInfo) != null)
                {
                    this.OnStop(providerName, activityName, task, ref activityId);
                    activityInfo = this.m_current.Value;
                }
            }
            long uniqueId = activityInfo != null?Interlocked.Increment(ref activityInfo.m_lastChildID) : Interlocked.Increment(ref ActivityTracker.m_nextId);

            relatedActivityId = activityInfo != null ? activityInfo.ActivityId : Guid.Empty;
            ActivityTracker.ActivityInfo list = new ActivityTracker.ActivityInfo(str, uniqueId, activityInfo, options);
            this.m_current.Value = list;
            activityId           = list.ActivityId;
            if (!tplEtwProvider.Debug)
            {
                return;
            }
            tplEtwProvider.DebugFacilityMessage("OnStartRetActivityState", ActivityTracker.ActivityInfo.LiveActivities(list));
            tplEtwProvider.DebugFacilityMessage1("OnStartRet", activityId.ToString(), relatedActivityId.ToString());
        }
        // Token: 0x06003319 RID: 13081 RVA: 0x000C22B0 File Offset: 0x000C04B0
        public void OnStart(string providerName, string activityName, int task, ref Guid activityId, ref Guid relatedActivityId, EventActivityOptions options)
        {
            if (this.m_current == null)
            {
                if (this.m_checkedForEnable)
                {
                    return;
                }
                this.m_checkedForEnable = true;
                if (TplEtwProvider.Log.IsEnabled(EventLevel.Informational, (EventKeywords)128L))
                {
                    this.Enable();
                }
                if (this.m_current == null)
                {
                    return;
                }
            }
            ActivityTracker.ActivityInfo value = this.m_current.Value;
            string         text = this.NormalizeActivityName(providerName, activityName, task);
            TplEtwProvider log  = TplEtwProvider.Log;

            if (log.Debug)
            {
                log.DebugFacilityMessage("OnStartEnter", text);
                log.DebugFacilityMessage("OnStartEnterActivityState", ActivityTracker.ActivityInfo.LiveActivities(value));
            }
            if (value != null)
            {
                if (value.m_level >= 100)
                {
                    activityId        = Guid.Empty;
                    relatedActivityId = Guid.Empty;
                    if (log.Debug)
                    {
                        log.DebugFacilityMessage("OnStartRET", "Fail");
                    }
                    return;
                }
                if ((options & EventActivityOptions.Recursive) == EventActivityOptions.None)
                {
                    ActivityTracker.ActivityInfo activityInfo = this.FindActiveActivity(text, value);
                    if (activityInfo != null)
                    {
                        this.OnStop(providerName, activityName, task, ref activityId);
                        value = this.m_current.Value;
                    }
                }
            }
            long uniqueId;

            if (value == null)
            {
                uniqueId = Interlocked.Increment(ref ActivityTracker.m_nextId);
            }
            else
            {
                uniqueId = Interlocked.Increment(ref value.m_lastChildID);
            }
            relatedActivityId = EventSource.CurrentThreadActivityId;
            ActivityTracker.ActivityInfo activityInfo2 = new ActivityTracker.ActivityInfo(text, uniqueId, value, relatedActivityId, options);
            this.m_current.Value = activityInfo2;
            activityId           = activityInfo2.ActivityId;
            if (log.Debug)
            {
                log.DebugFacilityMessage("OnStartRetActivityState", ActivityTracker.ActivityInfo.LiveActivities(activityInfo2));
                log.DebugFacilityMessage1("OnStartRet", activityId.ToString(), relatedActivityId.ToString());
            }
        }