diff options
author | James M Snell <jasnell@gmail.com> | 2018-03-06 21:42:37 +0300 |
---|---|---|
committer | James M Snell <jasnell@gmail.com> | 2018-03-16 20:54:05 +0300 |
commit | 96cb4fb795808aa2774e842974aeb411c5d3dd94 (patch) | |
tree | da8a3965240c402f857e6267e0a278f486852c3a /src/node_perf.h | |
parent | 879f521c654fffd34360be432a6280936ba94071 (diff) |
perf_hooks,trace_events: emit perf milestone trace events
Emit the perf_hooks node timing milestones as trace events.
PR-URL: https://github.com/nodejs/node/pull/19175
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Diffstat (limited to 'src/node_perf.h')
-rw-r--r-- | src/node_perf.h | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/src/node_perf.h b/src/node_perf.h index 0db99acd03e..703ef81ce48 100644 --- a/src/node_perf.h +++ b/src/node_perf.h @@ -27,6 +27,18 @@ extern const uint64_t timeOrigin; double GetCurrentTimeInMicroseconds(); +static inline const char* GetPerformanceMilestoneName( + enum PerformanceMilestone milestone) { + switch (milestone) { +#define V(name, label) case NODE_PERFORMANCE_MILESTONE_##name: return label; + NODE_PERFORMANCE_MILESTONES(V) +#undef V + default: + UNREACHABLE(); + return 0; + } +} + static inline PerformanceMilestone ToPerformanceMilestoneEnum(const char* str) { #define V(name, label) \ if (strcmp(str, label) == 0) return NODE_PERFORMANCE_MILESTONE_##name; @@ -44,12 +56,6 @@ static inline PerformanceEntryType ToPerformanceEntryTypeEnum( return NODE_PERFORMANCE_ENTRY_TYPE_INVALID; } -NODE_EXTERN inline void MarkPerformanceMilestone( - Environment* env, - PerformanceMilestone milestone) { - env->performance_state()->milestones[milestone] = PERFORMANCE_NOW(); -} - class PerformanceEntry { public: static void Notify(Environment* env, |