summaryrefslogtreecommitdiff
path: root/src/tracing
diff options
context:
space:
mode:
authorJames M Snell <jasnell@gmail.com>2018-02-14 11:06:32 -0800
committerJames M Snell <jasnell@gmail.com>2018-02-26 13:55:33 -0800
commit9e509b622bbdc14b7153d006f57043f268017138 (patch)
tree0a01cc2665342046c8c198bdff76eed869263978 /src/tracing
parentaca8e764da444a9a5eb67812db2317c1c32215d9 (diff)
downloadandroid-node-v8-9e509b622bbdc14b7153d006f57043f268017138.tar.gz
android-node-v8-9e509b622bbdc14b7153d006f57043f268017138.tar.bz2
android-node-v8-9e509b622bbdc14b7153d006f57043f268017138.zip
perf_hooks: emit trace events for marks, measures, and timerify
Adds the `node.perf.usertiming` trace events category for recording usertiming marks and measures (e.g. `perf_hooks.performance.mark()`) in the trace events timeline. Adds the `node.perf.function` trace events category for recording `perf_hooks.performance.timerify()` durations in the trace events timeline. PR-URL: https://github.com/nodejs/node/pull/18789 Reviewed-By: Ali Ijaz Sheikh <ofrobots@google.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Diffstat (limited to 'src/tracing')
-rw-r--r--src/tracing/trace_event.h17
1 files changed, 14 insertions, 3 deletions
diff --git a/src/tracing/trace_event.h b/src/tracing/trace_event.h
index 4aac9e5543..3fbe1b0a1f 100644
--- a/src/tracing/trace_event.h
+++ b/src/tracing/trace_event.h
@@ -244,9 +244,20 @@ enum CategoryGroupEnabledFlags {
// Adds a trace event with a given id, thread_id, and timestamp. Not
// Implemented.
-#define INTERNAL_TRACE_EVENT_ADD_WITH_ID_TID_AND_TIMESTAMP( \
- phase, category_group, name, id, thread_id, timestamp, flags, ...) \
- UNIMPLEMENTED()
+#define INTERNAL_TRACE_EVENT_ADD_WITH_ID_TID_AND_TIMESTAMP( \
+ phase, category_group, name, id, thread_id, timestamp, flags, ...) \
+ do { \
+ INTERNAL_TRACE_EVENT_GET_CATEGORY_INFO(category_group); \
+ if (INTERNAL_TRACE_EVENT_CATEGORY_GROUP_ENABLED_FOR_RECORDING_MODE()) { \
+ unsigned int trace_event_flags = flags | TRACE_EVENT_FLAG_HAS_ID; \
+ node::tracing::TraceID trace_event_trace_id(id, \
+ &trace_event_flags); \
+ node::tracing::AddTraceEventWithTimestamp( \
+ phase, INTERNAL_TRACE_EVENT_UID(category_group_enabled), name, \
+ trace_event_trace_id.scope(), trace_event_trace_id.raw_id(), \
+ node::tracing::kNoId, trace_event_flags, timestamp, ##__VA_ARGS__);\
+ } \
+ } while (0)
// Enter and leave a context based on the current scope.
#define INTERNAL_TRACE_EVENT_SCOPED_CONTEXT(category_group, name, context) \