Esempio n. 1
0
        internal void SetState(RequestState value)
        {
            if (this.curState == value)
            {
                return;
            }
            DateTime utcNow   = TimeProvider.UtcNow;
            TimeSpan duration = utcNow.Subtract(this.stateChangeTimestamp);

            this.RefreshDurations();
            if (RequestJobTimeTracker.SupportDurationTracking(this.curState))
            {
                RequestJobDurationData requestJobDurationData;
                if (!this.durations.TryGetValue(this.curState, out requestJobDurationData))
                {
                    requestJobDurationData = new RequestJobDurationData(this.curState);
                }
                requestJobDurationData.AddTime(duration);
                this.durations[this.curState] = requestJobDurationData;
            }
            this.stateChangeTimestamp = utcNow;
            this.curState             = value;
            if (RequestJobTimeTracker.SupportDurationTracking(this.curState))
            {
                this.UpdateActiveCounts(this.curState, 1L);
                this.IncRateCounts(this.curState);
            }
        }
Esempio n. 2
0
 public static void MergeTimestamps(RequestJobTimeTracker mrsTimeTracker, RequestJobTimeTracker other)
 {
     foreach (RequestJobTimestampData requestJobTimestampData in other.Timestamps)
     {
         if (!RequestJobTimeTracker.mrsMasteredTimestamps.Contains(requestJobTimestampData.Id))
         {
             if (RequestJobTimeTracker.nonMrsMasteredTimestamps.Contains(requestJobTimestampData.Id))
             {
                 mrsTimeTracker.SetTimestamp(requestJobTimestampData.Id, new DateTime?(requestJobTimestampData.Timestamp));
             }
             else
             {
                 DateTime?timestamp = mrsTimeTracker.GetTimestamp(requestJobTimestampData.Id);
                 if (timestamp == null || timestamp.Value < requestJobTimestampData.Timestamp)
                 {
                     mrsTimeTracker.SetTimestamp(requestJobTimestampData.Id, new DateTime?(requestJobTimestampData.Timestamp));
                 }
             }
         }
     }
     foreach (RequestJobTimestamp ts in RequestJobTimeTracker.nonMrsMasteredTimestamps)
     {
         if (other.GetTimestamp(ts) == null)
         {
             mrsTimeTracker.SetTimestamp(ts, null);
         }
     }
 }
Esempio n. 3
0
            private static IEnumerable <IObjectLogPropertyDefinition <RequestJobLogData> > GetTimeTrackerDurations()
            {
                List <IObjectLogPropertyDefinition <RequestJobLogData> > list = new List <IObjectLogPropertyDefinition <RequestJobLogData> >();

                foreach (object obj in Enum.GetValues(typeof(RequestState)))
                {
                    RequestState requestState = (RequestState)obj;
                    if (RequestJobTimeTracker.SupportDurationTracking(requestState))
                    {
                        list.Add(new RequestJobLog.RequestJobLogSchema.TimeTrackerDurationProperty(requestState));
                    }
                }
                return(list);
            }
Esempio n. 4
0
        public void Append(RequestJobTimeTracker timeTracker, ReportEntryFlags flags)
        {
            ThrottleDurations sourceThrottleDurations;
            ThrottleDurations targetThrottleDurations;

            timeTracker.GetThrottledDurations(out sourceThrottleDurations, out targetThrottleDurations);
            ReportEntry reportEntry = new ReportEntry();

            reportEntry.Flags = flags;
            if ((flags & ReportEntryFlags.SourceThrottleDurations) != ReportEntryFlags.None)
            {
                reportEntry.SourceThrottleDurations = sourceThrottleDurations;
            }
            if ((flags & ReportEntryFlags.TargetThrottleDurations) != ReportEntryFlags.None)
            {
                reportEntry.TargetThrottleDurations = targetThrottleDurations;
            }
            this.Append(reportEntry);
        }