Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
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,
(async () => {
system = await SI.system();
cpu = await SI.cpu();
os = await SI.osInfo();
setInterval(poll, argv.i);
app.listen(argv.p);
console.log(`Doppler running on port ${argv.p}`);
})();
si.osInfo(o => {
this.information.push(lang('hostname') + ': ' + isUndefined(o.hostname))
this.information.push(lang('platform') + ': ' + isUndefined(o.platform) + " " + isUndefined(o.arch))
this.information.push(lang('distribution') + ': ' + isUndefined(o.distro) + " " + isUndefined(o.release))
this.information.push(lang('kernelRel') + ': ' + isUndefined(o.kernel))
si.cpu(c => {
this.information.push(lang('cpuModel') + ': ' + isUndefined(c.manufacturer) + " " + isUndefined(c.brand))
this.information.push(lang('cpuSpeed') + ': ' + isUndefined(c.speed) + "GHz")
this.information.push(lang('cpuCores') + ': ' + c.cores)
})
})
}
private async getEncryptionKey(): Promise {
const s = await system();
const c = await cpu();
const m = await mem();
const o = await osInfo();
return s.manufacturer + ';' + s.uuid + ';' + String(c.processors) + ';'
+ c.vendor + ';' + m.total + ';' + o.platform + ';' + o.release;
}
async function systeminfo() {
const info = {};
await Promise.all([
si.battery().then(r => info.battery = r),
si.cpu().then(r => info.cpu = r),
si.osInfo().then(r => info.osInfo = r),
]);
return info;
}
async setup() {
const [
graphics,
os,
cpu,
mem,
online,
] = await Promise.all([
si.graphics(),
si.osInfo(),
si.cpu(),
si.mem(),
isOnline(),
])
this._graphics = graphics
this.os = os
this.cpu = cpu
this.memory = mem
this.online = online
logger.info(`GPU devices: ${this.graphics.length}`)
logger.info(`RAM: ${this.memory.total} bytes.`)
logger.info(`Internet connection: ${this.online}`)
logger.debug(this)
}
export const getSystemInformation = async () => {
return {
system: await systemInfo.system(),
time: systemInfo.time(),
cpu: await systemInfo.cpu(),
osInfo: await systemInfo.osInfo(),
package: {
name: pkg.name,
version: pkg.version,
repository: pkg.repository,
author: pkg.author,
"staart-version": pkg["staart-version"]
}
};
};
async getCPUCores(_context) {
return (await si.cpu()).cores;
}