github.com/hspak/nomad@v0.7.2-0.20180309000617-bc4ae22a39a5/ui/mirage/factories/client-allocation-stats.js (about)

     1  import { Factory } from 'ember-cli-mirage';
     2  
     3  export default Factory.extend({
     4    resourceUsage: generateResources,
     5  
     6    _taskNames: () => [], // Set by allocation
     7  
     8    tasks() {
     9      var hash = {};
    10      this._taskNames.forEach(task => {
    11        hash[task] = {
    12          Pids: null,
    13          ResourceUsage: generateResources(),
    14          Timestamp: Date.now(),
    15        };
    16      });
    17      return hash;
    18    },
    19  });
    20  
    21  function generateResources() {
    22    return {
    23      CpuStats: {
    24        Measured: ['Throttled Periods', 'Throttled Time', 'Percent'],
    25        Percent: 0.14159538847117795,
    26        SystemMode: 0,
    27        ThrottledPeriods: 0,
    28        ThrottledTime: 0,
    29        TotalTicks: 3.256693934837093,
    30        UserMode: 0,
    31      },
    32      MemoryStats: {
    33        Cache: 1744896,
    34        KernelMaxUsage: 0,
    35        KernelUsage: 0,
    36        MaxUsage: 4710400,
    37        Measured: ['RSS', 'Cache', 'Swap', 'Max Usage'],
    38        RSS: 1486848,
    39        Swap: 0,
    40      },
    41    };
    42  }