diff options
author | Anna Henningsen <anna@addaleax.net> | 2017-09-04 04:07:13 +0300 |
---|---|---|
committer | James M Snell <jasnell@gmail.com> | 2017-09-15 22:42:22 +0300 |
commit | dcb24e3be5546a9cdbc20d9a8d0efae8ebaf1520 (patch) | |
tree | cd3b94d1d92e3e437fd4abb26c8bd5a28ea48ff8 /src/node_perf.h | |
parent | 8403d6b99965cfe5b387690eb5e12ab2d0f3750e (diff) |
src: keep track of env properly in node_perf.cc
Currently, measuring GC timing using `node_perf` is somewhat broken,
because Isolates and Node Environments do not necessarily match 1:1;
each environment adds its own hook, so possibly the hook code runs
multiple times, but since it can’t reliably compute its corresponding
event loop based on the Isolate, each run targets the same Environment
right now.
This fixes that problem by using new overloads of the GC tracking
APIs that can pass data to the callback through opaque pointers.
PR-URL: https://github.com/nodejs/node/pull/15391
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Diffstat (limited to 'src/node_perf.h')
-rw-r--r-- | src/node_perf.h | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/node_perf.h b/src/node_perf.h index 412479c9023..ca4374ebc58 100644 --- a/src/node_perf.h +++ b/src/node_perf.h @@ -56,17 +56,23 @@ class PerformanceEntry : public BaseObject { class Data { public: Data( + Environment* env, const char* name, const char* type, uint64_t startTime, uint64_t endTime, int data = 0) : + env_(env), name_(name), type_(type), startTime_(startTime), endTime_(endTime), data_(data) {} + Environment* env() const { + return env_; + } + std::string name() const { return name_; } @@ -88,6 +94,7 @@ class PerformanceEntry : public BaseObject { } private: + Environment* env_; std::string name_; std::string type_; uint64_t startTime_; |