Comparing version 0.0.20 to 0.0.21
@@ -70,15 +70,15 @@ "use strict"; | ||
const start = Utils.time(); | ||
this.refresh(); | ||
(level > -1) && this.refresh(); | ||
const mem = process.memoryUsage(); | ||
const total = process.cpuUsage(); | ||
const usage = this.cpuUsage = process.cpuUsage(this.cpuUsage); | ||
const cpus = os.cpus().map(c => (Object.assign({ model: c.model, speed: c.speed }, c.times))); | ||
const networks = Object.entries(os.networkInterfaces()) | ||
const cpus = (level > -2) ? os.cpus().map(c => (Object.assign({ model: c.model, speed: c.speed }, c.times))) : undefined; | ||
const networks = (level > -2) ? Object.entries(os.networkInterfaces()) | ||
.map(([k, v]) => ([k, v.filter(i => !i.internal && i.family !== 'IPv6')])) | ||
.filter(([k, v]) => v.length) | ||
.map(([k, v]) => (Object.assign({ name: k }, v[0]))); | ||
const packages = Object.values(this.packages); | ||
const modules = Object.values(this.modules); | ||
let scriptSize = 0; | ||
modules.forEach(m => scriptSize += m.size); | ||
.map(([k, v]) => (Object.assign({ name: k }, v[0]))) : undefined; | ||
const packages = (level > -1) ? Object.values(this.packages) : undefined; | ||
const modules = (level > -1) ? Object.values(this.modules) : undefined; | ||
let scriptSize = modules && 0; | ||
modules && modules.forEach(m => scriptSize += m.size); | ||
const span = Utils.span(start); | ||
@@ -99,14 +99,14 @@ return { | ||
uptime: process.uptime(), | ||
memory: mem.rss, | ||
heapTotal: mem.heapTotal, | ||
heapUsed: mem.heapUsed, | ||
external: mem.external, | ||
cpuUser: usage.user, | ||
cpuSystem: usage.system, | ||
cpuUserTotal: total.user, | ||
cpuSystemTotal: total.system, | ||
packageCount: packages.length, | ||
moduleCount: modules.length, | ||
memory: mem && mem.rss, | ||
heapTotal: mem && mem.heapTotal, | ||
heapUsed: mem && mem.heapUsed, | ||
external: mem && mem.external, | ||
cpuUser: usage && usage.user, | ||
cpuSystem: usage && usage.system, | ||
cpuUserTotal: total && total.user, | ||
cpuSystemTotal: total && total.system, | ||
packageCount: packages && packages.length, | ||
moduleCount: modules && modules.length, | ||
scriptSize, | ||
node: { | ||
node: (level > -2) ? { | ||
pid: process.pid, | ||
@@ -117,8 +117,8 @@ arch: process.arch, | ||
versions: process.versions | ||
}, | ||
} : undefined, | ||
cpus, | ||
networks, | ||
entry: this.entry, | ||
packages: packages.filter((m) => level === undefined || m.level <= level), | ||
modules: modules.filter((m) => level === undefined || m.level <= level) | ||
packages: modules && packages.filter((m) => level === undefined || m.level <= level), | ||
modules: modules && modules.filter((m) => level === undefined || m.level <= level) | ||
}; | ||
@@ -125,0 +125,0 @@ } |
{ | ||
"name": "exer", | ||
"version": "0.0.20", | ||
"version": "0.0.21", | ||
"description": "Utils in TypeScript, Debug, NanoTimer ...", | ||
@@ -5,0 +5,0 @@ "author": "kbajalc@gmail.com", |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
113029