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); }
private DateTime?GetTimestamp(RequestJobTimestamp type) { if (this.timeTracker == null) { return(null); } return(this.timeTracker.GetDisplayTimestamp(type)); }
public DateTime?GetDisplayTimestamp(RequestJobTimestamp ts) { DateTime?timestamp = this.GetTimestamp(ts); if (timestamp == null) { return(null); } return(new DateTime?(timestamp.Value.ToLocalTime())); }
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 }); }
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); }
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; } }
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()); }
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); }
public TimeTrackerTimeStampProperty(RequestJobTimestamp rjts) { this.rjts = rjts; }
public RequestJobTimestampData(RequestJobTimestamp id, DateTime timestamp) { this.id = id; this.timestamp = timestamp; }