public SystemWorkloadManagerEvent(ResourceLoad load, int slots, bool delayed) { this.DateTime = TimeProvider.UtcNow; this.Load = load; this.Slots = slots; this.Delayed = delayed; }
public ResourceLoad InterpretMetricValue(int value) { ResourceLoad unknown; if (value < 0) { unknown = ResourceLoad.Unknown; } else if (value > this.CriticalThreshold) { unknown = new ResourceLoad(ResourceLoad.Critical.LoadRatio, new int?(value), null); } else if (value > this.OverloadedThreshold) { unknown = new ResourceLoad((double)value / (double)this.UnderloadedThreshold, new int?(value), null); } else if (value >= this.UnderloadedThreshold) { unknown = new ResourceLoad(ResourceLoad.Full.LoadRatio, new int?(value), null); } else { unknown = new ResourceLoad((double)value / (double)this.UnderloadedThreshold, new int?(value), null); } return(unknown); }
public override bool Equals(object obj) { if (obj == null) { return(this.State == ResourceLoadState.Unknown); } if (obj is ResourceLoad) { ResourceLoad resourceLoad = (ResourceLoad)obj; return(this.loadRatio == resourceLoad.loadRatio); } return(false); }
private static void Record(ref SystemWorkloadManagerLogEntry lastEntry, SystemWorkloadManagerLogEntryType type, ResourceKey resource, WorkloadClassification classification, ResourceLoad load, int slots, bool delayed) { if ((SystemWorkloadManagerBlackBox.active == null || SystemWorkloadManagerBlackBox.active.Contains(classification)) && (lastEntry == null || lastEntry.CurrentEvent.Load.State != load.State || lastEntry.CurrentEvent.Slots != slots || lastEntry.CurrentEvent.Delayed != delayed)) { SystemWorkloadManagerEvent currentEvent = new SystemWorkloadManagerEvent(load, slots, delayed); lock (SystemWorkloadManagerBlackBox.history) { while (SystemWorkloadManagerBlackBox.history.Count >= SystemWorkloadManagerBlackBox.maxHistoryDepth) { SystemWorkloadManagerBlackBox.history.Dequeue(); } if (lastEntry == null) { lastEntry = new SystemWorkloadManagerLogEntry(type, resource, classification, currentEvent, null); SystemWorkloadManagerBlackBox.history.Enqueue(lastEntry); } else { lastEntry = new SystemWorkloadManagerLogEntry(type, resource, classification, currentEvent, lastEntry.CurrentEvent); SystemWorkloadManagerBlackBox.history.Enqueue(lastEntry); } } } }
public static void RecordAdmissionUpdate(ref SystemWorkloadManagerLogEntry lastEntry, ResourceKey resource, WorkloadClassification classification, ResourceLoad load, int slots, bool delayed) { SystemWorkloadManagerBlackBox.Record(ref lastEntry, SystemWorkloadManagerLogEntryType.Admission, resource, classification, load, slots, delayed); }
public static void RecordMonitorUpdate(ref SystemWorkloadManagerLogEntry lastEntry, ResourceKey resource, WorkloadClassification classification, ResourceLoad load) { SystemWorkloadManagerBlackBox.Record(ref lastEntry, SystemWorkloadManagerLogEntryType.Monitor, resource, classification, load, -1, false); }