Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
trace_events: add version metadata
Use `TRACE_EVENT_METADATA1` to include just the node.js version for
now. Later this can be expanded to include more version and platform
details.
  • Loading branch information
jasnell committed May 25, 2018
commit c2e27595e7c4878275a89a55f93799f6f1f167fb
1 change: 1 addition & 0 deletions src/node.cc
Original file line number Diff line number Diff line change
Expand Up @@ -4231,6 +4231,7 @@ inline int Start(Isolate* isolate, IsolateData* isolate_data,
Environment env(isolate_data, context, v8_platform.GetTracingAgent());
env.Start(argc, argv, exec_argc, exec_argv, v8_is_profiling);

TRACE_EVENT_METADATA1("__metadata", "version", "node", NODE_VERSION_STRING);
TRACE_EVENT_METADATA1("__metadata", "thread_name", "name",
"JavaScriptMainThread");

Expand Down
6 changes: 5 additions & 1 deletion test/parallel/test-trace-events-metadata.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ tmpdir.refresh();
process.chdir(tmpdir.path);

const proc = cp.spawn(process.execPath,
[ '--trace-events-enabled', '-e', CODE ]);
[ '--trace-event-categories', 'node.perf.usertiming',
'-e', CODE ]);
proc.once('exit', common.mustCall(() => {
assert(common.fileExists(FILE_NAME));
fs.readFile(FILE_NAME, common.mustCall((err, data) => {
Expand All @@ -25,5 +26,8 @@ proc.once('exit', common.mustCall(() => {
assert(traces.some((trace) =>
trace.cat === '__metadata' && trace.name === 'thread_name' &&
trace.args.name === 'BackgroundTaskRunner'));
assert(traces.some((trace) =>
trace.cat === '__metadata' && trace.name === 'version' &&
trace.args.node === process.versions.node));
}));
}));