Esempio n. 1
0
 public static string Path(ActivityTracker.ActivityInfo activityInfo)
 {
     if (activityInfo == null)
     {
         return("");
     }
     return(ActivityTracker.ActivityInfo.Path(activityInfo.m_creator) + "/" + (object)activityInfo.m_uniqueId);
 }
Esempio n. 2
0
 public static string LiveActivities(ActivityTracker.ActivityInfo list)
 {
     if (list == null)
     {
         return("");
     }
     return(list.ToString() + ";" + ActivityTracker.ActivityInfo.LiveActivities(list.m_creator));
 }
Esempio n. 3
0
 public ActivityInfo(string name, long uniqueId, ActivityTracker.ActivityInfo creator, EventActivityOptions options)
 {
     this.m_name         = name;
     this.m_eventOptions = options;
     this.m_creator      = creator;
     this.m_uniqueId     = uniqueId;
     this.m_level        = creator != null ? creator.m_level + 1 : 0;
     this.CreateActivityPathGuid(out this.m_guid, out this.m_activityPathGuidOffset);
 }
 // Token: 0x06006B33 RID: 27443 RVA: 0x00172800 File Offset: 0x00170A00
 public ActivityInfo(string name, long uniqueId, ActivityTracker.ActivityInfo creator, Guid activityIDToRestore, EventActivityOptions options)
 {
     this.m_name                = name;
     this.m_eventOptions        = options;
     this.m_creator             = creator;
     this.m_uniqueId            = uniqueId;
     this.m_level               = ((creator != null) ? (creator.m_level + 1) : 0);
     this.m_activityIdToRestore = activityIDToRestore;
     this.CreateActivityPathGuid(out this.m_guid, out this.m_activityPathGuidOffset);
 }
Esempio n. 5
0
 private ActivityTracker.ActivityInfo FindActiveActivity(string name, ActivityTracker.ActivityInfo startLocation)
 {
     for (ActivityTracker.ActivityInfo activityInfo = startLocation; activityInfo != null; activityInfo = activityInfo.m_creator)
     {
         if (name == activityInfo.m_name && activityInfo.m_stopped == 0)
         {
             return(activityInfo);
         }
     }
     return((ActivityTracker.ActivityInfo)null);
 }
Esempio n. 6
0
 private unsafe void CreateOverflowGuid(Guid *outPtr)
 {
     for (ActivityTracker.ActivityInfo activityInfo = this.m_creator; activityInfo != null; activityInfo = activityInfo.m_creator)
     {
         if (activityInfo.m_activityPathGuidOffset <= 10)
         {
             uint id     = (uint)Interlocked.Increment(ref activityInfo.m_lastChildID);
             *    outPtr = activityInfo.m_guid;
             if (ActivityTracker.ActivityInfo.AddIdToGuid(outPtr, activityInfo.m_activityPathGuidOffset, id, true) <= 12)
             {
                 break;
             }
         }
     }
 }
 private unsafe void CreateOverflowGuid(Guid *outPtr)
 {
     for (ActivityTracker.ActivityInfo creator = this.m_creator; creator != null; creator = creator.m_creator)
     {
         if (creator.m_activityPathGuidOffset <= 10)
         {
             uint id     = (uint)Interlocked.Increment(ref creator.m_lastChildID);
             *    outPtr = creator.m_guid;
             int  num    = ActivityTracker.ActivityInfo.AddIdToGuid(outPtr, creator.m_activityPathGuidOffset, id, true);
             if (num <= 12)
             {
                 break;
             }
         }
     }
 }
Esempio n. 8
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: 0x06003320 RID: 13088 RVA: 0x000C2668 File Offset: 0x000C0868
 private void ActivityChanging(AsyncLocalValueChangedArgs <ActivityTracker.ActivityInfo> args)
 {
     ActivityTracker.ActivityInfo activityInfo  = args.CurrentValue;
     ActivityTracker.ActivityInfo previousValue = args.PreviousValue;
     if (previousValue != null && previousValue.m_creator == activityInfo && (activityInfo == null || previousValue.m_activityIdToRestore != activityInfo.ActivityId))
     {
         EventSource.SetCurrentThreadActivityId(previousValue.m_activityIdToRestore);
         return;
     }
     while (activityInfo != null)
     {
         if (activityInfo.m_stopped == 0)
         {
             EventSource.SetCurrentThreadActivityId(activityInfo.ActivityId);
             return;
         }
         activityInfo = activityInfo.m_creator;
     }
 }
Esempio n. 10
0
        public void OnStop(string providerName, string activityName, int task, ref Guid activityId)
        {
            if (this.m_current == null)
            {
                return;
            }
            string         str            = this.NormalizeActivityName(providerName, activityName, task);
            TplEtwProvider tplEtwProvider = TplEtwProvider.Log;

            if (tplEtwProvider.Debug)
            {
                tplEtwProvider.DebugFacilityMessage("OnStopEnter", str);
                tplEtwProvider.DebugFacilityMessage("OnStopEnterActivityState", ActivityTracker.ActivityInfo.LiveActivities(this.m_current.Value));
            }
            ActivityTracker.ActivityInfo list;
            ActivityTracker.ActivityInfo activeActivity;
            do
            {
                ActivityTracker.ActivityInfo startLocation = this.m_current.Value;
                list           = (ActivityTracker.ActivityInfo)null;
                activeActivity = this.FindActiveActivity(str, startLocation);
                if (activeActivity == null)
                {
                    activityId = Guid.Empty;
                    if (!tplEtwProvider.Debug)
                    {
                        return;
                    }
                    tplEtwProvider.DebugFacilityMessage("OnStopRET", "Fail");
                    return;
                }
                activityId = activeActivity.ActivityId;
                ActivityTracker.ActivityInfo activityInfo = startLocation;
                while (activityInfo != activeActivity && activityInfo != null)
                {
                    if (activityInfo.m_stopped != 0)
                    {
                        activityInfo = activityInfo.m_creator;
                    }
                    else
                    {
                        if (activityInfo.CanBeOrphan())
                        {
                            if (list == null)
                            {
                                list = activityInfo;
                            }
                        }
                        else
                        {
                            activityInfo.m_stopped = 1;
                        }
                        activityInfo = activityInfo.m_creator;
                    }
                }
            }while (Interlocked.CompareExchange(ref activeActivity.m_stopped, 1, 0) != 0);
            if (list == null)
            {
                list = activeActivity.m_creator;
            }
            this.m_current.Value = list;
            if (!tplEtwProvider.Debug)
            {
                return;
            }
            tplEtwProvider.DebugFacilityMessage("OnStopRetActivityState", ActivityTracker.ActivityInfo.LiveActivities(list));
            tplEtwProvider.DebugFacilityMessage("OnStopRet", activityId.ToString());
        }
        // Token: 0x0600331A RID: 13082 RVA: 0x000C2438 File Offset: 0x000C0638
        public void OnStop(string providerName, string activityName, int task, ref Guid activityId)
        {
            if (this.m_current == null)
            {
                return;
            }
            string         text = this.NormalizeActivityName(providerName, activityName, task);
            TplEtwProvider log  = TplEtwProvider.Log;

            if (log.Debug)
            {
                log.DebugFacilityMessage("OnStopEnter", text);
                log.DebugFacilityMessage("OnStopEnterActivityState", ActivityTracker.ActivityInfo.LiveActivities(this.m_current.Value));
            }
            ActivityTracker.ActivityInfo activityInfo;
            for (;;)
            {
                ActivityTracker.ActivityInfo value = this.m_current.Value;
                activityInfo = null;
                ActivityTracker.ActivityInfo activityInfo2 = this.FindActiveActivity(text, value);
                if (activityInfo2 == null)
                {
                    break;
                }
                activityId = activityInfo2.ActivityId;
                ActivityTracker.ActivityInfo activityInfo3 = value;
                while (activityInfo3 != activityInfo2 && activityInfo3 != null)
                {
                    if (activityInfo3.m_stopped != 0)
                    {
                        activityInfo3 = activityInfo3.m_creator;
                    }
                    else
                    {
                        if (activityInfo3.CanBeOrphan())
                        {
                            if (activityInfo == null)
                            {
                                activityInfo = activityInfo3;
                            }
                        }
                        else
                        {
                            activityInfo3.m_stopped = 1;
                        }
                        activityInfo3 = activityInfo3.m_creator;
                    }
                }
                if (Interlocked.CompareExchange(ref activityInfo2.m_stopped, 1, 0) == 0)
                {
                    goto Block_9;
                }
            }
            activityId = Guid.Empty;
            if (log.Debug)
            {
                log.DebugFacilityMessage("OnStopRET", "Fail");
            }
            return;

Block_9:
            if (activityInfo == null)
            {
                ActivityTracker.ActivityInfo activityInfo2;
                activityInfo = activityInfo2.m_creator;
            }
            this.m_current.Value = activityInfo;
            if (log.Debug)
            {
                log.DebugFacilityMessage("OnStopRetActivityState", ActivityTracker.ActivityInfo.LiveActivities(activityInfo));
                log.DebugFacilityMessage("OnStopRet", activityId.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());
            }
        }