diff options
author | Christopher Hiller <boneskull@boneskull.com> | 2019-06-12 07:51:15 -0700 |
---|---|---|
committer | Rich Trott <rtrott@gmail.com> | 2019-06-15 20:53:07 -0700 |
commit | 7561a38ccd7cc6b543a81a62fdbd455f600f684e (patch) | |
tree | ca1cadfc5c72b4288183d9f2dea3ef8cadf88c35 /test | |
parent | 9939762322de29224fcbc2f08c4a6a4bc08d6ccd (diff) | |
download | android-node-v8-7561a38ccd7cc6b543a81a62fdbd455f600f684e.tar.gz android-node-v8-7561a38ccd7cc6b543a81a62fdbd455f600f684e.tar.bz2 android-node-v8-7561a38ccd7cc6b543a81a62fdbd455f600f684e.zip |
report: add cpu info to report output
The report shows CPU consumption %, but without the number of CPU cores,
a consumer cannot tell if the percent (given across all cores) is
actually problematic. E.g., 100% on one CPU is a problem, but 100% on
four CPUs is not necessarily.
This change adds CPU information (similar to `os.cpus()`) to the report
output. Extra info besides the count is also provided as to avoid future
breaking changes in the eventuality that someone needs it; changing the
datatype of `header.cpus` would be breaking.
PR-URL: https://github.com/nodejs/node/pull/28188
Refs: https://github.com/nodejs/diagnostics/issues/307
Reviewed-By: Sam Roberts <vieuxtech@gmail.com>
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com>
Reviewed-By: Richard Lau <riclau@uk.ibm.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Diffstat (limited to 'test')
-rw-r--r-- | test/common/report.js | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/test/common/report.js b/test/common/report.js index 163daf286e..f415b66dcc 100644 --- a/test/common/report.js +++ b/test/common/report.js @@ -62,8 +62,8 @@ function _validateContent(data) { 'dumpEventTimeStamp', 'processId', 'commandLine', 'nodejsVersion', 'wordSize', 'arch', 'platform', 'componentVersions', 'release', 'osName', 'osRelease', - 'osVersion', 'osMachine', 'host', 'glibcVersionRuntime', - 'glibcVersionCompiler', 'cwd']; + 'osVersion', 'osMachine', 'cpus', 'host', + 'glibcVersionRuntime', 'glibcVersionCompiler', 'cwd']; checkForUnknownFields(header, headerFields); assert.strictEqual(typeof header.event, 'string'); assert.strictEqual(typeof header.trigger, 'string'); @@ -87,6 +87,16 @@ function _validateContent(data) { assert.strictEqual(header.osRelease, os.release()); assert.strictEqual(typeof header.osVersion, 'string'); assert.strictEqual(typeof header.osMachine, 'string'); + assert(Array.isArray(header.cpus)); + header.cpus.forEach((cpu) => { + assert.strictEqual(typeof cpu.model, 'string'); + assert.strictEqual(typeof cpu.speed, 'number'); + assert.strictEqual(typeof cpu.user, 'number'); + assert.strictEqual(typeof cpu.nice, 'number'); + assert.strictEqual(typeof cpu.sys, 'number'); + assert.strictEqual(typeof cpu.idle, 'number'); + assert.strictEqual(typeof cpu.irq, 'number'); + }); assert.strictEqual(header.host, os.hostname()); // Verify the format of the javascriptStack section. |