Ejemplo n.º 1
0
        internal RequestJobTimeTrackerXML GetDiagnosticInfo(RequestStatisticsDiagnosticArgument arguments)
        {
            bool showTimeSlots = arguments.HasArgument("showtimeslots");

            this.RefreshDurations();
            RequestJobTimeTrackerXML requestJobTimeTrackerXML = new RequestJobTimeTrackerXML();

            requestJobTimeTrackerXML.CurrentState             = this.CurrentState.ToString();
            requestJobTimeTrackerXML.LastStateChangeTimeStamp = this.stateChangeTimestamp.ToString("O");
            for (RequestJobTimestamp requestJobTimestamp = RequestJobTimestamp.None; requestJobTimestamp < RequestJobTimestamp.MaxTimestamp; requestJobTimestamp++)
            {
                DateTime?timestamp = this.GetTimestamp(requestJobTimestamp);
                if (timestamp != null)
                {
                    requestJobTimeTrackerXML.AddTimestamp(requestJobTimestamp, timestamp.Value);
                }
            }
            foreach (RequestJobStateNode treeRoot in RequestJobStateNode.RootStates)
            {
                RequestJobTimeTrackerXML.DurationRec durationRec = this.DumpDurationTreeForDiagnostics(treeRoot, showTimeSlots);
                if (durationRec != null && durationRec.Duration != TimeSpan.Zero.ToString())
                {
                    if (requestJobTimeTrackerXML.Durations == null)
                    {
                        requestJobTimeTrackerXML.Durations = new List <RequestJobTimeTrackerXML.DurationRec>();
                    }
                    requestJobTimeTrackerXML.Durations.Add(durationRec);
                }
            }
            return(requestJobTimeTrackerXML);
        }
Ejemplo n.º 2
0
 private DateTime?GetTimestamp(RequestJobTimestamp type)
 {
     if (this.timeTracker == null)
     {
         return(null);
     }
     return(this.timeTracker.GetDisplayTimestamp(type));
 }
Ejemplo n.º 3
0
        public DateTime?GetDisplayTimestamp(RequestJobTimestamp ts)
        {
            DateTime?timestamp = this.GetTimestamp(ts);

            if (timestamp == null)
            {
                return(null);
            }
            return(new DateTime?(timestamp.Value.ToLocalTime()));
        }
Ejemplo n.º 4
0
        public DateTime?GetTimestamp(RequestJobTimestamp ts)
        {
            DateTime value;

            if (this.timestamps.TryGetValue(ts, out value))
            {
                return(new DateTime?(value));
            }
            return(null);
        }
 public void AddTimestamp(RequestJobTimestamp mrt, DateTime value)
 {
     if (this.Timestamps == null)
     {
         this.Timestamps = new List <RequestJobTimeTrackerXML.TimestampRec>();
     }
     this.Timestamps.Add(new RequestJobTimeTrackerXML.TimestampRec
     {
         Type      = mrt.ToString(),
         Timestamp = value
     });
 }
Ejemplo n.º 6
0
            private static IEnumerable <IObjectLogPropertyDefinition <RequestJobLogData> > GetTimeTrackerTimestamps()
            {
                List <IObjectLogPropertyDefinition <RequestJobLogData> > list = new List <IObjectLogPropertyDefinition <RequestJobLogData> >();

                foreach (object obj in Enum.GetValues(typeof(RequestJobTimestamp)))
                {
                    RequestJobTimestamp requestJobTimestamp = (RequestJobTimestamp)obj;
                    if (RequestJobTimeTracker.SupportTimestampTracking(requestJobTimestamp))
                    {
                        list.Add(new RequestJobLog.RequestJobLogSchema.TimeTrackerTimeStampProperty(requestJobTimestamp));
                    }
                }
                return(list);
            }
Ejemplo n.º 7
0
 public void SetTimestamp(RequestJobTimestamp ts, DateTime?value)
 {
     if (value == null)
     {
         if (this.timestamps.ContainsKey(ts))
         {
             this.timestamps.Remove(ts);
             return;
         }
     }
     else
     {
         this.timestamps[ts] = value.Value;
     }
 }
Ejemplo n.º 8
0
        public override string ToString()
        {
            this.RefreshDurations();
            StringBuilder stringBuilder = new StringBuilder();

            stringBuilder.AppendFormat("Current state: {0}\n", this.CurrentState);
            stringBuilder.AppendFormat("Last state change: {0}\n", this.stateChangeTimestamp);
            stringBuilder.AppendLine("Durations (per-slot data is in milliseconds):");
            foreach (RequestJobStateNode treeRoot in RequestJobStateNode.RootStates)
            {
                this.DumpDurationTree(stringBuilder, treeRoot, string.Empty);
            }
            stringBuilder.AppendLine("Timestamps:");
            for (RequestJobTimestamp requestJobTimestamp = RequestJobTimestamp.None; requestJobTimestamp < RequestJobTimestamp.MaxTimestamp; requestJobTimestamp++)
            {
                stringBuilder.AppendFormat("{0} {1}\n", requestJobTimestamp, this.GetDisplayTimestamp(requestJobTimestamp));
            }
            return(stringBuilder.ToString());
        }
Ejemplo n.º 9
0
        public static bool SupportTimestampTracking(RequestJobTimestamp timestamp)
        {
            if (timestamp != RequestJobTimestamp.None)
            {
                switch (timestamp)
                {
                case RequestJobTimestamp.DomainControllerUpdate:
                case RequestJobTimestamp.RequestCanceled:
                case RequestJobTimestamp.LastSuccessfulSourceConnection:
                case RequestJobTimestamp.LastSuccessfulTargetConnection:
                case RequestJobTimestamp.SourceConnectionFailure:
                case RequestJobTimestamp.TargetConnectionFailure:
                case RequestJobTimestamp.IsIntegStarted:
                case RequestJobTimestamp.LastServerBusyBackoff:
                case RequestJobTimestamp.ServerBusyBackoffUntil:
                case RequestJobTimestamp.MaxTimestamp:
                    break;

                default:
                    return(true);
                }
            }
            return(false);
        }
Ejemplo n.º 10
0
 public TimeTrackerTimeStampProperty(RequestJobTimestamp rjts)
 {
     this.rjts = rjts;
 }
Ejemplo n.º 11
0
 public RequestJobTimestampData(RequestJobTimestamp id, DateTime timestamp)
 {
     this.id        = id;
     this.timestamp = timestamp;
 }