| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 873cc72 commit f08b83b
5 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -639,6 +639,7 @@ The value may be one of: | |||
| 639 | 639 | ||
| 640 | 640 | * `perf_hooks.constants.NODE_PERFORMANCE_GC_MAJOR` | |
| 641 | 641 | * `perf_hooks.constants.NODE_PERFORMANCE_GC_MINOR` | |
| 642 | + * `perf_hooks.constants.NODE_PERFORMANCE_GC_MINOR_MARK_SWEEP` | ||
| 642 | 643 | * `perf_hooks.constants.NODE_PERFORMANCE_GC_INCREMENTAL` | |
| 643 | 644 | * `perf_hooks.constants.NODE_PERFORMANCE_GC_WEAKCB` | |
| 644 | 645 | ||
@@ -650,6 +651,7 @@ When `performanceEntry.type` is equal to `'gc'`, the | |||
| 650 | 651 | * `kind` {number} One of: | |
| 651 | 652 | * `perf_hooks.constants.NODE_PERFORMANCE_GC_MAJOR` | |
| 652 | 653 | * `perf_hooks.constants.NODE_PERFORMANCE_GC_MINOR` | |
| 654 | + * `perf_hooks.constants.NODE_PERFORMANCE_GC_MINOR_MARK_SWEEP` | ||
| 653 | 655 | * `perf_hooks.constants.NODE_PERFORMANCE_GC_INCREMENTAL` | |
| 654 | 656 | * `perf_hooks.constants.NODE_PERFORMANCE_GC_WEAKCB` | |
| 655 | 657 | * `flags` {number} One of: | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -365,6 +365,7 @@ void CreatePerContextProperties(Local<Object> target, | |||
| 365 | 365 | ||
| 366 | 366 | NODE_DEFINE_CONSTANT(constants, NODE_PERFORMANCE_GC_MAJOR); | |
| 367 | 367 | NODE_DEFINE_CONSTANT(constants, NODE_PERFORMANCE_GC_MINOR); | |
| 368 | + NODE_DEFINE_CONSTANT(constants, NODE_PERFORMANCE_GC_MINOR_MARK_SWEEP); | ||
| 368 | 369 | NODE_DEFINE_CONSTANT(constants, NODE_PERFORMANCE_GC_INCREMENTAL); | |
| 369 | 370 | NODE_DEFINE_CONSTANT(constants, NODE_PERFORMANCE_GC_WEAKCB); | |
| 370 | 371 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -63,6 +63,7 @@ inline PerformanceEntryType ToPerformanceEntryTypeEnum( | |||
| 63 | 63 | enum PerformanceGCKind { | |
| 64 | 64 | NODE_PERFORMANCE_GC_MAJOR = v8::GCType::kGCTypeMarkSweepCompact, | |
| 65 | 65 | NODE_PERFORMANCE_GC_MINOR = v8::GCType::kGCTypeScavenge, | |
| 66 | + NODE_PERFORMANCE_GC_MINOR_MARK_SWEEP = v8::GCType::kGCTypeMinorMarkSweep, | ||
| 66 | 67 | NODE_PERFORMANCE_GC_INCREMENTAL = v8::GCType::kGCTypeIncrementalMarking, | |
| 67 | 68 | NODE_PERFORMANCE_GC_WEAKCB = v8::GCType::kGCTypeProcessWeakCallbacks | |
| 68 | 69 | }; | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -0,0 +1,36 @@ | |||
| 1 | + // Flags: --expose-gc --no-warnings --minor-ms | ||
| 2 | + 'use strict'; | ||
| 3 | + | ||
| 4 | + // When V8's Minor Mark-Sweep collector is enabled (--minor-ms), minor garbage | ||
| 5 | + // collections are reported with kind NODE_PERFORMANCE_GC_MINOR_MARK_SWEEP | ||
| 6 | + // rather than NODE_PERFORMANCE_GC_MINOR. | ||
| 7 | + | ||
| 8 | + const common = require('../common'); | ||
| 9 | + const assert = require('assert'); | ||
| 10 | + const { gcUntil } = require('../common/gc'); | ||
| 11 | + const { | ||
| 12 | + PerformanceObserver, | ||
| 13 | + constants | ||
| 14 | + } = require('perf_hooks'); | ||
| 15 | + | ||
| 16 | + const { | ||
| 17 | + NODE_PERFORMANCE_GC_MINOR_MARK_SWEEP | ||
| 18 | + } = constants; | ||
| 19 | + | ||
| 20 | + let observed = false; | ||
| 21 | + const obs = new PerformanceObserver(common.mustCallAtLeast((list) => { | ||
| 22 | + for (const entry of list.getEntries()) { | ||
| 23 | + // Other GC kinds (e.g. a scheduled or incremental GC) may be observed in | ||
| 24 | + // between; only the minor mark-sweep entry is relevant here. | ||
| 25 | + if (entry.detail.kind === NODE_PERFORMANCE_GC_MINOR_MARK_SWEEP) { | ||
| 26 | + assert.strictEqual(entry.name, 'gc'); | ||
| 27 | + assert.strictEqual(entry.entryType, 'gc'); | ||
| 28 | + observed = true; | ||
| 29 | + obs.disconnect(); | ||
| 30 | + return; | ||
| 31 | + } | ||
| 32 | + } | ||
| 33 | + })); | ||
| 34 | + obs.observe({ entryTypes: ['gc'] }); | ||
| 35 | + | ||
| 36 | + gcUntil('minor gc event', () => observed, 10, { type: 'minor' }); | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -11,6 +11,7 @@ const { | |||
| 11 | 11 | const { | |
| 12 | 12 | NODE_PERFORMANCE_GC_MAJOR, | |
| 13 | 13 | NODE_PERFORMANCE_GC_MINOR, | |
| 14 | + NODE_PERFORMANCE_GC_MINOR_MARK_SWEEP, | ||
| 14 | 15 | NODE_PERFORMANCE_GC_INCREMENTAL, | |
| 15 | 16 | NODE_PERFORMANCE_GC_WEAKCB, | |
| 16 | 17 | NODE_PERFORMANCE_GC_FLAGS_FORCED | |
@@ -19,6 +20,7 @@ const { | |||
| 19 | 20 | const kinds = [ | |
| 20 | 21 | NODE_PERFORMANCE_GC_MAJOR, | |
| 21 | 22 | NODE_PERFORMANCE_GC_MINOR, | |
| 23 | + NODE_PERFORMANCE_GC_MINOR_MARK_SWEEP, | ||
| 22 | 24 | NODE_PERFORMANCE_GC_INCREMENTAL, | |
| 23 | 25 | NODE_PERFORMANCE_GC_WEAKCB, | |
| 24 | 26 | ]; | |
| Back | FazBrowse Home | New Git URL |
0 commit comments