private AggregatedComputeStats accummulateComputeFigures( PlacementCapacityUpdateTaskState state, List<ComputeState> computes, Map<String, ComputeDescription> computeDescriptions) { AggregatedComputeStats aggregatedStats = state.aggregatedStats != null ? state.aggregatedStats : new AggregatedComputeStats(); for (ComputeState compute : computes) { ComputeDescription computeDescription = computeDescriptions.get(compute.descriptionLink); if (computeDescription == null) { logWarning("No description found for compute '%s', skipping it", compute.documentSelfLink); continue; } ComputeStats stats = getComputeStats(state, compute, computeDescription); if (stats == null) { continue; } aggregatedStats.computeCount++; aggregatedStats.totalMemoryBytes += stats.totalMemoryBytes; aggregatedStats.cpuCoreCount += stats.cpuCoreCount; aggregatedStats.totalCpuMhz += stats.cpuCoreCount * stats.cpuMhzPerCore; aggregatedStats.availableMemoryBytes += stats.availableMemoryBytes; aggregatedStats.cpuUsageSumAllCores += stats.cpuCoreCount * stats.cpuUsage; } return aggregatedStats; }