<commit_before>var si = require('systeminformation'),
  utils = require('../utils');

var colors = utils.colors;

function Mem(line, memDonut, swapDonut) {
  this.line = line;
  this.memDonut = memDonut;
  this.swapDonut = swapDonut;


  si.mem(data => {
    this.memData = [{
        title: 'Memory',
        style: {
          line: colors[0]
        },
        x: Array(61).fill().map((_, i) => 60 - i),
        y: Array(61).fill(0)
      },
      {
        title: 'Swap',
        style: {
          line: colors[1]
        },
        x: Array(61).fill().map((_, i) => 60 - i),
        y: Array(61).fill(0)
      }
    ];
    this.updateData(data);
    this.interval = setInterval(() => {
      si.mem(data => {
        this.updateData(data);
      })
    }, 1000);
  });
}

Mem.prototype.updateData = function(data) {

  var memPer = (100 * (1 - data.available / data.total)).toFixed(1);
  var swapPer = (100 * (1 - data.swapfree / data.swaptotal)).toFixed(1);

  swapPer = isNaN(swapPer) ? 0 : swapPer;

  this.memData[0].y.shift();
  this.memData[0].y.push(memPer);

  this.memData[1].y.shift();
  this.memData[1].y.push(swapPer);

  var memTitle =<commit_msg>under 1% interpreted as ratio .1->10%, so no floating<commit_after>var si = require('systeminformation'),
  utils = require('../utils');

var colors = utils.colors;

function Mem(line, memDonut, swapDonut) {
  this.line = line;
  this.memDonut = memDonut;
  this.swapDonut = swapDonut;


  si.mem(data => {
    this.memData = [{
        title: 'Memory',
        style: {
          line: colors[0]
        },
        x: Array(61).fill().map((_, i) => 60 - i),
        y: Array(61).fill(0)
      },
      {
        title: 'Swap',
        style: {
          line: colors[1]
        },
        x: Array(61).fill().map((_, i) => 60 - i),
        y: Array(61).fill(0)
      }
    ];
    this.updateData(data);
    this.interval = setInterval(() => {
      si.mem(data => {
        this.updateData(data);
      })
    }, 1000);
  });
}

Mem.prototype.updateData = function(data) {

  var memPer = (100 * (1 - data.available / data.total)).toFixed();
  var swapPer = (100 * (1 - data.swapfree / data.swaptotal)).toFixed();

  swapPer = isNaN(swapPer) ? 0 : swapPer;

  this.memData[0].y.shift();
  this.memData[0].y.push(memPer);

  this.memData[1].y.shift();
  this.memData[1].y.push(swapPer);

  var memTitle =
{'fraction_non_alphanumeric': 0.1881856540084388, 'fraction_numerical': 0.030379746835443037, 'mean_word_length': 2.243502051983584, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 14, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3468536', 'n_tokens_mistral': 902, 'n_tokens_neox': 853, 'n_words': 156}