Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
06/26/15 11:16:48 (9 years ago)
Author:
dglaser
Message:

#2394:

HeuristicLab.Services.WebApp.Status-3.3:

  • changed the DataController to return memory in kb instead of gb
  • fixed the memory rounding error
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Services.WebApp.Status/3.3/WebApi/DataController.cs

    r12514 r12521  
    7373        var activeSlaves = onlineSlaves.Where(s => s.IsAllowedToCalculate).ToList();
    7474        var calculatingSlaves = activeSlaves.Where(s => s.SlaveState == SlaveState.Calculating).ToList();
    75         int calculatingMemory = calculatingSlaves.Any() ? (int)calculatingSlaves.Sum(s => s.Memory) / 1024 : 0;
    76         int freeCalculatingMemory = calculatingSlaves.Any() ? (int)calculatingSlaves.Sum(s => s.FreeMemory) / 1024 : 0;
     75        int calculatingMemory = calculatingSlaves.Any() ? (int)calculatingSlaves.Sum(s => s.Memory) : 0;
     76        int freeCalculatingMemory = calculatingSlaves.Any() ? (int)calculatingSlaves.Sum(s => s.FreeMemory) : 0;
    7777
    7878        return new DTO.Status {
     
    9595          },
    9696          MemoryStatus = new DTO.MemoryStatus {
    97             TotalMemory = onlineSlaves.Any() ? (int)onlineSlaves.Sum(s => s.Memory) / 1024 : 0,
    98             FreeMemory = onlineSlaves.Any() ? (int)onlineSlaves.Sum(s => s.FreeMemory) / 1024 : 0,
    99             ActiveMemory = activeSlaves.Any() ? (int)activeSlaves.Sum(s => s.Memory) / 1024 : 0,
     97            TotalMemory = onlineSlaves.Any() ? (int)onlineSlaves.Sum(s => s.Memory) : 0,
     98            FreeMemory = onlineSlaves.Any() ? (int)onlineSlaves.Sum(s => s.FreeMemory) : 0,
     99            ActiveMemory = activeSlaves.Any() ? (int)activeSlaves.Sum(s => s.Memory) : 0,
    100100            UsedMemory = calculatingMemory - freeCalculatingMemory
    101101          },
     
    109109            Cores = x.Cores ?? 0,
    110110            FreeCores = x.FreeCores ?? 0,
    111             Memory = (x.Memory ?? 0) / 1024,
    112             FreeMemory = (x.FreeMemory ?? 0) / 1024,
     111            Memory = x.Memory ?? 0,
     112            FreeMemory = x.FreeMemory ?? 0,
    113113            IsAllowedToCalculate = x.IsAllowedToCalculate,
    114114            State = x.SlaveState.ToString()
     
    149149                                                             ? statistic.SlaveStatistics.Average(x => x.CpuUtilization)
    150150                                                             : 0.0;
    151           status.MemoryStatus.TotalMemory += statistic.SlaveStatistics.Sum(x => x.Memory) / 1024;
    152           freeMemory += statistic.SlaveStatistics.Sum(x => x.FreeMemory) / 1024;
     151          status.MemoryStatus.TotalMemory += statistic.SlaveStatistics.Sum(x => x.Memory);
     152          freeMemory += statistic.SlaveStatistics.Sum(x => x.FreeMemory);
    153153          if (i >= increment) {
    154154            status.Timestamp = JavascriptUtils.ToTimestamp(statistic.Timestamp);
Note: See TracChangeset for help on using the changeset viewer.