How to use the systeminformation.currentLoad function in systeminformation

To help you get started, we’ve selected a few systeminformation examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github Polymer / tachometer / src / json-output.ts View on Github external
export async function legacyJsonOutput(results: BenchmarkResult[]):
    Promise {
  // TODO Add git info.
  const battery = await systeminformation.battery();
  const cpu = await systeminformation.cpu();
  const currentLoad = await systeminformation.currentLoad();
  const memory = await systeminformation.mem();
  return {
    benchmarks: results,
    datetime: new Date().toISOString(),
    system: {
      cpu: {
        manufacturer: cpu.manufacturer,
        model: cpu.model,
        family: cpu.family,
        speed: cpu.speed,
        cores: cpu.cores,
      },
      load: {
        average: currentLoad.avgload,
        current: currentLoad.currentload,
      },
github sykeben / RasDash / api.js View on Github external
api.get('/cpu/usage', function(req, res) { // CPU Usage % (cpu/usage)
  si.currentLoad()
    .then(data => res.send(data.currentload.toString()))
    .catch(error => res.status(404).send(siError))
})
github introlab / odas_web / resources / js / interface.js View on Github external
function updateSi() { // Gather params

    var sysInfo = {cpu:0,mem:0,temp:0};

    si.currentLoad(function(data) {
        sysInfo.cpu = data.currentload;

        si.mem(function(data) {
            sysInfo.mem = (data.active/data.total)*100;

            si.cpuTemperature(function(data) {
                sysInfo.temp = data.main;

                systemMonitor.system.cpu = sysInfo.cpu.toPrecision(3).toString() + ' %';
                systemMonitor.system.mem = sysInfo.mem.toPrecision(2).toString() + ' %';
                systemMonitor.system.temp = sysInfo.temp.toPrecision(3).toString() + ' °C';
                systemMonitor.system.ip = ip.address();

            });
        });
    });
github oguzhaninan / Stacer / src / components / dashboard / CpuBar.js View on Github external
setInterval(() => {
			try {
				si.currentLoad(val => {
					this.cpuValue = val.currentload.toFixed(0)
					cpuBar.animate(this.cpuValue / 100)
				})
			} catch(err) {
				
			}
		}, 1000)
	}
github oguzhaninan / Stacer / src / components / resources / CpuHistory.js View on Github external
mounted() {
		si.currentLoad(val => {
			let cpuCount = val.cpus.length

			for (var i = 0; i < cpuCount; i++)
				this.cpuValues.push([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
					0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
				])

			let cpuChart = new Chartkick.LineChart('cpus-chart', this.cpuData, {
				colors: ['#2ecc71', '#e74c3c', '#3498db', '#f1c40f', '#9b59b6', '#34495e',
					 '#1abc9c', '#e67e22', '#46f0f0', '#f032e6', '#fabebe', '#008080',
					 '#e6beff', '#aa6e28', '#d2f53c', '#800000', '#aaffc3', '#808000',
					 '#000080', '#808080'],
				legend: true,
				min: 0,
				max: 100,
				points: false
github Hyperline / hyperline / src / lib / plugins / cpu.js View on Github external
getCpuLoad() {
    cpuLoad().then(({ currentload }) =>
      this.setState({
        cpuLoad: leftPad(currentload.toFixed(2), 2, 0)
      })
    )
  }
github DeadPackets / HackPi / server / functions / fn.js View on Github external
si.cpuTemperature(function(temp) {
			si.currentLoad(function(load) {
				SYSINFO.cpu = {
					speed,
					temp,
					load
				}
			})
		})
	})
github EnKrypt / Doppler / backend / src / app.ts View on Github external
const poll = async () => {
    cpuLoad = await SI.currentLoad();
    mem = await SI.mem();
    disk = await SI.fsSize();
    processes = await SI.processes();
    network = await SI.networkStats();
    try {
        cpuTemp = await SI.cpuTemperature();
        if (!cpuTemp.cores.length) {
            throw new Error('Cannot monitor CPU temperature');
        }
    } catch (e) {
        cpuTemp = {
            main: 0,
            cores: Array(cpu.cores).fill(0),
            max: 0
        };
        if (!tempFlag) {