GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — perf_hooks: add NODE_PERFORMANCE_GC_MINOR_MARK_SWEEP constant · nodejs/node@f90f1bd

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • doc/api
    • perf_hooks.md
  • src
    • node_perf.cc
    • node_perf.h
  • test/parallel
    • test-performance-gc-minor-ms.js
    • test-performance-gc.js
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎doc/api/perf_hooks.md‎

Copy file name to clipboardExpand all lines: doc/api/perf_hooks.md
+2Lines changed: 2 additions & 0 deletions
  • Display the source diff
  • Display the rich diff
Original file line numberDiff line numberDiff line change
@@ -643,6 +643,7 @@ The value may be one of:
643643

644644
* `perf_hooks.constants.NODE_PERFORMANCE_GC_MAJOR`
645645
* `perf_hooks.constants.NODE_PERFORMANCE_GC_MINOR`
646+
* `perf_hooks.constants.NODE_PERFORMANCE_GC_MINOR_MARK_SWEEP`
646647
* `perf_hooks.constants.NODE_PERFORMANCE_GC_INCREMENTAL`
647648
* `perf_hooks.constants.NODE_PERFORMANCE_GC_WEAKCB`
648649

@@ -654,6 +655,7 @@ When `performanceEntry.type` is equal to `'gc'`, the
654655
* `kind` {number} One of:
655656
* `perf_hooks.constants.NODE_PERFORMANCE_GC_MAJOR`
656657
* `perf_hooks.constants.NODE_PERFORMANCE_GC_MINOR`
658+
* `perf_hooks.constants.NODE_PERFORMANCE_GC_MINOR_MARK_SWEEP`
657659
* `perf_hooks.constants.NODE_PERFORMANCE_GC_INCREMENTAL`
658660
* `perf_hooks.constants.NODE_PERFORMANCE_GC_WEAKCB`
659661
* `flags` {number} One of:
Collapse file

‎src/node_perf.cc‎

Copy file name to clipboardExpand all lines: src/node_perf.cc
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -365,6 +365,7 @@ void CreatePerContextProperties(Local<Object> target,
365365

366366
NODE_DEFINE_CONSTANT(constants, NODE_PERFORMANCE_GC_MAJOR);
367367
NODE_DEFINE_CONSTANT(constants, NODE_PERFORMANCE_GC_MINOR);
368+
NODE_DEFINE_CONSTANT(constants, NODE_PERFORMANCE_GC_MINOR_MARK_SWEEP);
368369
NODE_DEFINE_CONSTANT(constants, NODE_PERFORMANCE_GC_INCREMENTAL);
369370
NODE_DEFINE_CONSTANT(constants, NODE_PERFORMANCE_GC_WEAKCB);
370371

Collapse file

‎src/node_perf.h‎

Copy file name to clipboardExpand all lines: src/node_perf.h
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ inline PerformanceEntryType ToPerformanceEntryTypeEnum(
6363
enum PerformanceGCKind {
6464
NODE_PERFORMANCE_GC_MAJOR = v8::GCType::kGCTypeMarkSweepCompact,
6565
NODE_PERFORMANCE_GC_MINOR = v8::GCType::kGCTypeScavenge,
66+
NODE_PERFORMANCE_GC_MINOR_MARK_SWEEP = v8::GCType::kGCTypeMinorMarkSweep,
6667
NODE_PERFORMANCE_GC_INCREMENTAL = v8::GCType::kGCTypeIncrementalMarking,
6768
NODE_PERFORMANCE_GC_WEAKCB = v8::GCType::kGCTypeProcessWeakCallbacks
6869
};
Collapse file

‎test/parallel/test-performance-gc-minor-ms.js‎

Copy file name to clipboard
+36Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff 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' });
Collapse file

‎test/parallel/test-performance-gc.js‎

Copy file name to clipboardExpand all lines: test/parallel/test-performance-gc.js
+2Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ const {
1111
const {
1212
NODE_PERFORMANCE_GC_MAJOR,
1313
NODE_PERFORMANCE_GC_MINOR,
14+
NODE_PERFORMANCE_GC_MINOR_MARK_SWEEP,
1415
NODE_PERFORMANCE_GC_INCREMENTAL,
1516
NODE_PERFORMANCE_GC_WEAKCB,
1617
NODE_PERFORMANCE_GC_FLAGS_FORCED
@@ -19,6 +20,7 @@ const {
1920
const kinds = [
2021
NODE_PERFORMANCE_GC_MAJOR,
2122
NODE_PERFORMANCE_GC_MINOR,
23+
NODE_PERFORMANCE_GC_MINOR_MARK_SWEEP,
2224
NODE_PERFORMANCE_GC_INCREMENTAL,
2325
NODE_PERFORMANCE_GC_WEAKCB,
2426
];

0 commit comments

Comments
0 (0)
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.