nv-inspector-trace-s0-util
v1.0.2
Published
nv-inspector-trace-s0-util ============================== - simple wrap of node trace\_events - support malformed-trace.log-file OR incomplete-trace.log-file, which cant NOT be parsed by JSON.parse
Downloads
1
Readme
nv-inspector-trace-s0-util
- simple wrap of node trace_events
- support malformed-trace.log-file OR incomplete-trace.log-file, which cant NOT be parsed by JSON.parse
which could happend in some special test-cases
install
usage
const {trace,parse_from_file,parse_from_json} = require("nv-inspector-trace-s0-util")
example
const {trace} = require("nv-inspector-trace-s0-util")
var rslt = await trace(3000/*trace for 3000 ms*/)
rslt.BYCATE rslt.BYDUR rslt.BYNAME rslt.BYPH
rslt.BYTDUR rslt.args rslt.cates rslt.displays
rslt.durs rslt.evts rslt.names rslt.phs
rslt.tdurs rslt.ts rslt.tts
> rslt.cates
[
'__metadata',
'devtools.timeline,v8',
'node,node.async_hooks',
'node,node.environment',
'node,node.vm,node.vm.script',
'v8'
]
> rslt.BYCATE.__metadata[0]
{
pid: 94479,
tid: 94479,
ts: 2777337755299,
tts: 139377,
ph: 'M',
cat: '__metadata',
name: 'process_name',
dur: 0,
tdur: 0,
args: { name: '/usr/local/bin/node' }
}
>
> rslt.names
[
'CheckImmediate',
'FSREQCALLBACK',
'FSREQCALLBACK_CALLBACK',
'MajorGC',
'PROMISE',
'PROMISE_CALLBACK',
'RunAndClearNativeImmediates',
'RunInThisContext',
'RunTimers',
'TTYWRAP',
'TTYWRAP_CALLBACK',
'TickObject',
'TickObject_CALLBACK',
'Timeout',
'Timeout_CALLBACK',
'V8.GCFinalizeMCReduceMemory',
'V8.GCIncrementalMarking',
'V8.GCIncrementalMarkingFinalize',
'V8.GCIncrementalMarkingStart',
'V8.GCPhantomHandleProcessingCallback',
'node',
'process_name',
'thread_name',
'version'
]
> rslt.BYNAME.PROMISE[0]
{
pid: 94479,
tid: 94479,
ts: 2777337760514,
tts: 141527,
ph: 'b',
cat: 'node,node.async_hooks',
name: 'PROMISE',
dur: 0,
tdur: 0,
id: '0x62',
args: { data: { triggerAsyncId: 5, executionAsyncId: 5 } }
}
>
> console.dir(rslt.args,{depth:null})
[
{ data: { executionAsyncId: 60, triggerAsyncId: 60 } },
{ data: { executionAsyncId: 74, triggerAsyncId: 74 } },
{ data: { triggerAsyncId: 5, executionAsyncId: 5 } },
{ data: { triggerAsyncId: 57, executionAsyncId: 5 } },
{ data: { triggerAsyncId: 58, executionAsyncId: 5 } },
{ data: { triggerAsyncId: 59, executionAsyncId: 5 } },
{ data: { triggerAsyncId: 60, executionAsyncId: 60 } },
{ data: { triggerAsyncId: 63, executionAsyncId: 5 } },
{ data: { triggerAsyncId: 65, executionAsyncId: 65 } },
{ data: { triggerAsyncId: 68, executionAsyncId: 5 } },
{ data: { triggerAsyncId: 69, executionAsyncId: 5 } },
{ name: '/usr/local/bin/node' },
{ name: 'JavaScriptMainThread' },
{ node: '16.13.1' },
{
process: {
versions: {
node: '16.13.1',
v8: '9.4.146.24-node.14',
uv: '1.42.0',
zlib: '1.2.11',
brotli: '1.0.9',
ares: '1.18.1',
modules: '93',
nghttp2: '1.45.1',
napi: '8',
llhttp: '6.0.4',
openssl: '1.1.1l+quic',
cldr: '39.0',
icu: '69.1',
tz: '2021a',
unicode: '13.0',
ngtcp2: '0.1.0-DEV',
nghttp3: '0.1.0-DEV'
},
arch: 'x64',
platform: 'linux',
release: { name: 'node', lts: 'Gallium' }
}
},
{}
]
APIS
- async trace(duration=5000)
- parse_from_json(j)
- async parse_from_file(fn)
LICENSE
- ISC