GeezerVison is showing github.com — bootstrap: support perf hooks in snapshot · ide/node@50cfbf9
File treeExpand file treeCollapse file tree Open diff view settings Expand file treeCollapse file tree Open diff view settings Collapse file Copy file name to clipboardExpand all lines: src/histogram.cc +32-1Lines changed: 32 additions & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
| 1 | 1 | #include "histogram.h" // NOLINT(build/include_inline) | 2 | | -#include "histogram-inl.h" | 3 | 2 | #include "base_object-inl.h" | | 3 | +#include "histogram-inl.h" | 4 | 4 | #include "memory_tracker-inl.h" | 5 | 5 | #include "node_errors.h" | | 6 | +#include "node_external_reference.h" | | 7 | + | 6 | 8 | namespace node { | 7 | 9 |
| 8 | 10 | using v8::BigInt; | @@ -197,6 +199,21 @@ Local<FunctionTemplate> HistogramBase::GetConstructorTemplate( | 197 | 199 | return tmpl; | 198 | 200 | } | 199 | 201 |
| | 202 | +void HistogramBase::RegisterExternalReferences( | | 203 | + ExternalReferenceRegistry* registry) { | | 204 | + registry->Register(New); | | 205 | + registry->Register(GetExceeds); | | 206 | + registry->Register(GetMin); | | 207 | + registry->Register(GetMax); | | 208 | + registry->Register(GetMean); | | 209 | + registry->Register(GetStddev); | | 210 | + registry->Register(GetPercentile); | | 211 | + registry->Register(GetPercentiles); | | 212 | + registry->Register(DoReset); | | 213 | + registry->Register(Record); | | 214 | + registry->Register(RecordDelta); | | 215 | +} | | 216 | + | 200 | 217 | void HistogramBase::Initialize(Environment* env, Local<Object> target) { | 201 | 218 | env->SetConstructorFunction(target, "Histogram", GetConstructorTemplate(env)); | 202 | 219 | } | @@ -240,6 +257,20 @@ Local<FunctionTemplate> IntervalHistogram::GetConstructorTemplate( | 240 | 257 | return tmpl; | 241 | 258 | } | 242 | 259 |
| | 260 | +void IntervalHistogram::RegisterExternalReferences( | | 261 | + ExternalReferenceRegistry* registry) { | | 262 | + registry->Register(GetExceeds); | | 263 | + registry->Register(GetMin); | | 264 | + registry->Register(GetMax); | | 265 | + registry->Register(GetMean); | | 266 | + registry->Register(GetStddev); | | 267 | + registry->Register(GetPercentile); | | 268 | + registry->Register(GetPercentiles); | | 269 | + registry->Register(DoReset); | | 270 | + registry->Register(Start); | | 271 | + registry->Register(Stop); | | 272 | +} | | 273 | + | 243 | 274 | IntervalHistogram::IntervalHistogram( | 244 | 275 | Environment* env, | 245 | 276 | Local<Object> wrap, | |
Collapse file Copy file name to clipboardExpand all lines: src/histogram.h +5Lines changed: 5 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
| 18 | 18 |
| 19 | 19 | namespace node { | 20 | 20 |
| | 21 | +class ExternalReferenceRegistry; | | 22 | + | 21 | 23 | constexpr int kDefaultHistogramFigures = 3; | 22 | 24 |
| 23 | 25 | class Histogram : public MemoryRetainer { | @@ -78,6 +80,7 @@ class HistogramBase : public BaseObject, public HistogramImpl { | 78 | 80 | static v8::Local<v8::FunctionTemplate> GetConstructorTemplate( | 79 | 81 | Environment* env); | 80 | 82 | static void Initialize(Environment* env, v8::Local<v8::Object> target); | | 83 | + static void RegisterExternalReferences(ExternalReferenceRegistry* registry); | 81 | 84 |
| 82 | 85 | static BaseObjectPtr<HistogramBase> Create( | 83 | 86 | Environment* env, | @@ -154,6 +157,8 @@ class IntervalHistogram : public HandleWrap, public HistogramImpl { | 154 | 157 | RESET | 155 | 158 | }; | 156 | 159 |
| | 160 | + static void RegisterExternalReferences(ExternalReferenceRegistry* registry); | | 161 | + | 157 | 162 | static v8::Local<v8::FunctionTemplate> GetConstructorTemplate( | 158 | 163 | Environment* env); | 159 | 164 |
| |
Collapse file Copy file name to clipboardExpand all lines: src/node_external_reference.h +1Lines changed: 1 addition & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -61,6 +61,7 @@ class ExternalReferenceRegistry { | 61 | 61 | V(heap_utils) \ | 62 | 62 | V(messaging) \ | 63 | 63 | V(native_module) \ | | 64 | + V(performance) \ | 64 | 65 | V(process_methods) \ | 65 | 66 | V(process_object) \ | 66 | 67 | V(task_queue) \ | |
Collapse file Copy file name to clipboardExpand all lines: src/node_perf.cc +23-2Lines changed: 23 additions & 2 deletions | Original file line number | Diff line number | Diff line change |
|---|
| | 1 | +#include "node_perf.h" | 1 | 2 | #include "aliased_buffer.h" | 2 | 3 | #include "env-inl.h" | 3 | 4 | #include "histogram-inl.h" | 4 | 5 | #include "memory_tracker-inl.h" | 5 | | -#include "node_internals.h" | 6 | | -#include "node_perf.h" | 7 | 6 | #include "node_buffer.h" | | 7 | +#include "node_external_reference.h" | | 8 | +#include "node_internals.h" | 8 | 9 | #include "node_process-inl.h" | 9 | 10 | #include "util-inl.h" | 10 | 11 |
| @@ -250,6 +251,12 @@ void ELDHistogram::Initialize(Environment* env, Local<Object> target) { | 250 | 251 | env->SetConstructorFunction(target, "ELDHistogram", tmpl); | 251 | 252 | } | 252 | 253 |
| | 254 | +void ELDHistogram::RegisterExternalReferences( | | 255 | + ExternalReferenceRegistry* registry) { | | 256 | + registry->Register(New); | | 257 | + IntervalHistogram::RegisterExternalReferences(registry); | | 258 | +} | | 259 | + | 253 | 260 | ELDHistogram::ELDHistogram( | 254 | 261 | Environment* env, | 255 | 262 | Local<Object> wrap, | @@ -364,7 +371,21 @@ void Initialize(Local<Object> target, | 364 | 371 | ELDHistogram::Initialize(env, target); | 365 | 372 | } | 366 | 373 |
| | 374 | +void RegisterExternalReferences(ExternalReferenceRegistry* registry) { | | 375 | + registry->Register(MarkMilestone); | | 376 | + registry->Register(SetupPerformanceObservers); | | 377 | + registry->Register(InstallGarbageCollectionTracking); | | 378 | + registry->Register(RemoveGarbageCollectionTracking); | | 379 | + registry->Register(Notify); | | 380 | + registry->Register(LoopIdleTime); | | 381 | + registry->Register(GetTimeOrigin); | | 382 | + registry->Register(GetTimeOriginTimeStamp); | | 383 | + HistogramBase::RegisterExternalReferences(registry); | | 384 | + ELDHistogram::RegisterExternalReferences(registry); | | 385 | +} | 367 | 386 | } // namespace performance | 368 | 387 | } // namespace node | 369 | 388 |
| 370 | 389 | NODE_MODULE_CONTEXT_AWARE_INTERNAL(performance, node::performance::Initialize) | | 390 | +NODE_MODULE_EXTERNAL_REFERENCE(performance, | | 391 | + node::performance::RegisterExternalReferences) |
Collapse file Copy file name to clipboardExpand all lines: src/node_perf.h +5-2Lines changed: 5 additions & 2 deletions | Original file line number | Diff line number | Diff line change |
|---|
| 3 | 3 |
| 4 | 4 | #if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS | 5 | 5 |
| 6 | | -#include "node.h" | 7 | | -#include "node_perf_common.h" | 8 | 6 | #include "base_object-inl.h" | 9 | 7 | #include "histogram.h" | | 8 | +#include "node.h" | | 9 | +#include "node_internals.h" | | 10 | +#include "node_perf_common.h" | 10 | 11 |
| 11 | 12 | #include "v8.h" | 12 | 13 | #include "uv.h" | | 16 | 17 | namespace node { | 17 | 18 |
| 18 | 19 | class Environment; | | 20 | +class ExternalReferenceRegistry; | 19 | 21 |
| 20 | 22 | namespace performance { | 21 | 23 |
| @@ -160,6 +162,7 @@ using GCPerformanceEntry = PerformanceEntry<GCPerformanceEntryTraits>; | 160 | 162 |
| 161 | 163 | class ELDHistogram : public IntervalHistogram { | 162 | 164 | public: | | 165 | + static void RegisterExternalReferences(ExternalReferenceRegistry* registry); | 163 | 166 | static void Initialize(Environment* env, v8::Local<v8::Object> target); | 164 | 167 | static void New(const v8::FunctionCallbackInfo<v8::Value>& args); | 165 | 168 |
| |
|