Comparing version
@@ -42,3 +42,3 @@ export const constants: { | ||
export function cpuUsage(previous?: { user: number; system: number }): { | ||
export interface CpuUsage { | ||
user: number | ||
@@ -48,2 +48,6 @@ system: number | ||
export function cpuUsage(previous?: CpuUsage): CpuUsage | ||
export function threadCpuUsage(previous?: CpuUsage): CpuUsage | ||
export function resourceUsage(): { | ||
@@ -83,2 +87,14 @@ userCPUTime: number | ||
export function cpus(): { | ||
model: string | ||
speed: number | ||
times: { | ||
user: number | ||
nice: number | ||
sys: number | ||
idle: number | ||
irq: number | ||
} | ||
}[] | ||
export function getProcessTitle(): string | ||
@@ -85,0 +101,0 @@ |
13
index.js
@@ -61,2 +61,15 @@ const binding = require('./binding') | ||
exports.threadCpuUsage = function threadCpuUsage(previous) { | ||
const current = binding.threadCpuUsage() | ||
if (previous) { | ||
return { | ||
user: current.user - previous.user, | ||
system: current.system - previous.system | ||
} | ||
} | ||
return current | ||
} | ||
exports.resourceUsage = binding.resourceUsage | ||
@@ -63,0 +76,0 @@ exports.memoryUsage = binding.memoryUsage |
{ | ||
"name": "bare-os", | ||
"version": "3.4.0", | ||
"version": "3.5.0", | ||
"description": "Operating system utilities for Javascript", | ||
@@ -5,0 +5,0 @@ "exports": { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
585569
1.1%174
15.23%