diff options
Diffstat (limited to 'src/node_perf_common.h')
-rw-r--r-- | src/node_perf_common.h | 29 |
1 files changed, 12 insertions, 17 deletions
diff --git a/src/node_perf_common.h b/src/node_perf_common.h index 75d266afc25..6c4c98813e7 100644 --- a/src/node_perf_common.h +++ b/src/node_perf_common.h @@ -8,6 +8,7 @@ #include "v8.h" #include <algorithm> +#include <iostream> #include <map> #include <string> @@ -54,23 +55,17 @@ enum PerformanceEntryType { class PerformanceState { public: - explicit PerformanceState(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) { - for (size_t i = 0; i < milestones.Length(); i++) - milestones[i] = -1.; - } + struct SerializeInfo { + AliasedBufferInfo root; + AliasedBufferInfo milestones; + AliasedBufferInfo observers; + }; + + explicit PerformanceState(v8::Isolate* isolate, const SerializeInfo* info); + SerializeInfo Serialize(v8::Local<v8::Context> context, + v8::SnapshotCreator* creator); + void Deserialize(v8::Local<v8::Context> context); + friend std::ostream& operator<<(std::ostream& o, const SerializeInfo& i); AliasedUint8Array root; AliasedFloat64Array milestones; |