Exemple #1
0
 public SystemWorkloadManagerEvent(ResourceLoad load, int slots, bool delayed)
 {
     this.DateTime = TimeProvider.UtcNow;
     this.Load     = load;
     this.Slots    = slots;
     this.Delayed  = delayed;
 }
Exemple #2
0
        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);
        }
Exemple #3
0
 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);
 }
Exemple #4
0
 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);
             }
         }
     }
 }
Exemple #5
0
 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);
 }
Exemple #6
0
 public static void RecordMonitorUpdate(ref SystemWorkloadManagerLogEntry lastEntry, ResourceKey resource, WorkloadClassification classification, ResourceLoad load)
 {
     SystemWorkloadManagerBlackBox.Record(ref lastEntry, SystemWorkloadManagerLogEntryType.Monitor, resource, classification, load, -1, false);
 }