Ejemplo n.º 1
0
 /// <summary>
 /// Add a number of recorded visit pints against this identifier
 /// </summary>
 /// <param name="spid">the sequence point identifier - NOTE 0 is not used</param>
 /// <param name="trackedMethodId">the id of a tracked method - Note 0 means no method currently tracking</param>
 /// <param name="sum">the number of visit points to add</param>
 public static bool AddVisitCount(uint spid, uint trackedMethodId, int sum = 1)
 {
     if (spid != 0 && spid < InstrumentPoints.Count)
     {
         var point = InstrumentPoints[(int)spid];
         point.VisitCount += sum;
         if (point.VisitCount < 0)
         {
             point.VisitCount = int.MaxValue;
         }
         if (trackedMethodId != 0)
         {
             point._tracked = point._tracked ?? new List <TrackedMethodRef>();
             var tracked = point._tracked.Find(x => x.UniqueId == trackedMethodId);
             if (tracked == null)
             {
                 tracked = new TrackedMethodRef()
                 {
                     UniqueId = trackedMethodId, VisitCount = sum
                 };
                 point._tracked.Add(tracked);
             }
             else
             {
                 tracked.VisitCount += sum;
                 if (tracked.VisitCount < 0)
                 {
                     tracked.VisitCount = int.MaxValue;
                 }
             }
         }
         return(true);
     }
     return(false);
 }
        private static void AddOrUpdateTrackingPoint(uint trackedMethodId, int amount, InstrumentationPoint point)
        {
            point._tracked = point._tracked ?? new List <TrackedMethodRef>();
            var tracked = point._tracked.Find(x => x.UniqueId == trackedMethodId);

            if (tracked == null)
            {
                tracked = new TrackedMethodRef {
                    UniqueId = trackedMethodId, VisitCount = amount
                };
                point._tracked.Add(tracked);
            }
            else
            {
                tracked.VisitCount += amount;
                if (tracked.VisitCount < 0)
                {
                    tracked.VisitCount = int.MaxValue;
                }
            }
        }
Ejemplo n.º 3
0
 /// <summary>
 /// Add a number of recorded visit pints against this identifier
 /// </summary>
 /// <param name="spid">the sequence point identifier - NOTE 0 is not used</param>
 /// <param name="trackedMethodId">the id of a tracked method - Note 0 means no method currently tracking</param>
 /// <param name="sum">the number of visit points to add</param>
 public static bool AddVisitCount(uint spid, uint trackedMethodId, int sum = 1)
 {
     if (spid != 0 && spid < InstrumentPoints.Count)
     {
         var point = InstrumentPoints[(int) spid];
         point.VisitCount += sum;
         if (point.VisitCount < 0)
             point.VisitCount = int.MaxValue;
         if (trackedMethodId != 0)
         {
             point._tracked = point._tracked ?? new List<TrackedMethodRef>();
             var tracked = point._tracked.Find(x => x.UniqueId == trackedMethodId);
             if (tracked == null)
             {
                 tracked = new TrackedMethodRef {UniqueId = trackedMethodId, VisitCount = sum};
                 point._tracked.Add(tracked);
             }
             else
             {
                 tracked.VisitCount += sum;
                 if (tracked.VisitCount < 0)
                     tracked.VisitCount = int.MaxValue;
             }
         }
         return true;
     }
     return false;
 }
Ejemplo n.º 4
0
 /// <summary>
 /// Add a number of recorded visit pints against this identifier
 /// </summary>
 /// <param name="spid">the sequence point identifier - NOTE 0 is not used</param>
 /// <param name="trackedMethodId">the id of a tracked method - Note 0 means no method currently tracking</param>
 /// <param name="sum">the number of visit points to add</param>
 public static void AddCount(uint spid, uint trackedMethodId, int sum = 1)
 {
     var point = _instrumentPoints[(int) spid];
     point.VisitCount += sum;
     if (trackedMethodId != 0)
     {
         point._tracked = point._tracked ?? new List<TrackedMethodRef>();
         var tracked = point._tracked.Find(x => x.UniqueId == trackedMethodId);
         if (tracked == null)
         {
             tracked = new TrackedMethodRef(){UniqueId = trackedMethodId, VisitCount = sum};
             point._tracked.Add(tracked);
         }
         else
         {
             tracked.VisitCount += sum;
         }
     }
 }