コード例 #1
0
 public static void ExecuteMethod_PopulateMonitoringItems(RequestResourceUsageCollection[] resourcesToIncludeInMonitoring, UsageMonitorItem[] newMonitoringItems)
 {
     if (resourcesToIncludeInMonitoring.Length == 0 || newMonitoringItems.Length == 0)
         return;
     int currMonitoringItemIX = 0;
     var resourcesCombined = resourcesToIncludeInMonitoring.SelectMany(coll => coll.CollectionContent).ToArray();
     var currMonitoringItem = newMonitoringItems[currMonitoringItemIX];
     foreach (var resourceItem in resourcesCombined)
     {
         DateTime resourceItemTime = resourceItem.ProcessorUsage.TimeRange.EndTime;
         while (resourceItemTime >= currMonitoringItem.TimeRangeInclusiveStartExclusiveEnd.EndTime)
         {
             currMonitoringItemIX++;
             if (currMonitoringItemIX == newMonitoringItems.Length)
                 return;
             currMonitoringItem = newMonitoringItems[currMonitoringItemIX];
         }
         DateTime currMonitorStartTime = currMonitoringItem.TimeRangeInclusiveStartExclusiveEnd.StartTime;
         bool matchesTimes = currMonitorStartTime <= resourceItemTime &&
                             currMonitoringItem.TimeRangeInclusiveStartExclusiveEnd.EndTime > resourceItemTime;
         if(matchesTimes == false)
             throw new InvalidDataException("Invalid data processing to feed invalid data to populating items");
         var diffFromMonitorBegin = resourceItemTime - currMonitorStartTime;
         var completeMinutes = Math.Floor(diffFromMonitorBegin.TotalMinutes);
         int stepIndex = (int) (completeMinutes/currMonitoringItem.StepSizeInMinutes);
         // Add data to index entries
         addValuesToMonitorItem(resourceItem, currMonitoringItem, stepIndex);
     }
 }
コード例 #2
0
ファイル: TheBallCore.designer.cs プロジェクト: kallex/Caloom
 private void CopyContentFrom(RequestResourceUsageCollection sourceObject)
 {
     CollectionContent = sourceObject.CollectionContent;
             _unmodified_CollectionContent = sourceObject._unmodified_CollectionContent;
 }
コード例 #3
0
ファイル: TheBallCore.designer.cs プロジェクト: kallex/Caloom
 public static RequestResourceUsageCollection CreateDefault()
 {
     var result = new RequestResourceUsageCollection();
             return result;
 }
コード例 #4
0
ファイル: TheBallCore.designer.cs プロジェクト: kallex/Caloom
partial         static void CreateCustomDemo(ref RequestResourceUsageCollection customDemoObject);
 private static void storeOwnerContentsAsCollections(Dictionary<string, List<RequestResourceUsage>> ownerGroupedUsages)
 {
     var allKeys = ownerGroupedUsages.Keys;
     foreach (var ownerKey in allKeys)
     {
         IContainerOwner owner;
         if (ownerKey.StartsWith(SystemSupport.SystemOwnerRoot))
             owner = TBSystem.CurrSystem;
         else
             owner = VirtualOwner.FigureOwner(ownerKey);
         var ownerContent = ownerGroupedUsages[ownerKey];
         var firstRangeItem = ownerContent[0];
         var lastRangeItem = ownerContent[ownerContent.Count - 1];
         string collName = String.Format("{0}_{1}",
                                         firstRangeItem.ProcessorUsage.TimeRange.EndTime.ToString(
                                             "yyyyMMddHHmmssfff"),
                                         lastRangeItem.ProcessorUsage.TimeRange.EndTime.ToString(
                                             "yyyyMMddHHmmssfff"));
         //var existing = RequestResourceUsageCollection.RetrieveFromOwnerContent(owner, collName);
         //if (existing != null)
         //    continue;
         RequestResourceUsageCollection ownerCollection = new RequestResourceUsageCollection();
         ownerCollection.SetLocationAsOwnerContent(owner, collName);
         ownerCollection.CollectionContent = ownerContent;
         ownerCollection.StoreInformation(null, true);
     }
 }