Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nodejs/node.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKyle Farnung <kfarnung@microsoft.com>2018-01-22 22:43:35 +0300
committerKyle Farnung <kfarnung@microsoft.com>2018-01-25 04:29:45 +0300
commitbe2cbccf003d110cad00317090072788021efa56 (patch)
tree6a5431d3abcd80b1b7a13335988f22b34df698e8 /src/node_perf_common.h
parent142d6237b6b24d80c96fd2c68be471d29bb079e3 (diff)
http2,perf_hooks: perf state using AliasedBuffer
Update performance_state to use AliasedBuffer and update usage sites. PR-URL: https://github.com/nodejs/node/pull/18300 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: James M Snell <jasnell@gmail.com>
Diffstat (limited to 'src/node_perf_common.h')
-rw-r--r--src/node_perf_common.h31
1 files changed, 27 insertions, 4 deletions
diff --git a/src/node_perf_common.h b/src/node_perf_common.h
index 713f126d7f7..435a4cffe5a 100644
--- a/src/node_perf_common.h
+++ b/src/node_perf_common.h
@@ -61,10 +61,33 @@ enum PerformanceEntryType {
node::performance::NODE_PERFORMANCE_MILESTONE_##n); \
} while (0);
-struct performance_state {
- // doubles first so that they are always sizeof(double)-aligned
- double milestones[NODE_PERFORMANCE_MILESTONE_INVALID];
- uint32_t observers[NODE_PERFORMANCE_ENTRY_TYPE_INVALID];
+class performance_state {
+ public:
+ explicit performance_state(v8::Isolate* isolate) :
+ root(
+ isolate,
+ sizeof(performance_state_internal)),
+ milestones(
+ isolate,
+ offsetof(performance_state_internal, milestones),
+ NODE_PERFORMANCE_MILESTONE_INVALID,
+ root),
+ observers(
+ isolate,
+ offsetof(performance_state_internal, observers),
+ NODE_PERFORMANCE_ENTRY_TYPE_INVALID,
+ root) {}
+
+ AliasedBuffer<uint8_t, v8::Uint8Array> root;
+ AliasedBuffer<double, v8::Float64Array> milestones;
+ AliasedBuffer<uint32_t, v8::Uint32Array> observers;
+
+ private:
+ struct performance_state_internal {
+ // doubles first so that they are always sizeof(double)-aligned
+ double milestones[NODE_PERFORMANCE_MILESTONE_INVALID];
+ uint32_t observers[NODE_PERFORMANCE_ENTRY_TYPE_INVALID];
+ };
};
} // namespace performance