Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit c75ad3d

Browse filesBrowse files
IlyasShabiaduh95
authored andcommitted
v8: add GCProfiler support for erm
PR-URL: #61191 Reviewed-By: Aviv Keller <me@aviv.sh> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: René <contact.9a5d6388@renegade334.me.uk>
1 parent ade4fc2 commit c75ad3d
Copy full SHA for c75ad3d

3 files changed

+40-1Lines changed: 40 additions & 1 deletion

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎doc/api/v8.md‎

Copy file name to clipboardExpand all lines: doc/api/v8.md
+10-1Lines changed: 10 additions & 1 deletion
  • Display the source diff
  • Display the rich diff
Original file line numberDiff line numberDiff line change
@@ -1471,6 +1471,7 @@ added:
14711471
-->
14721472
14731473
Create a new instance of the `v8.GCProfiler` class.
1474+
This API supports `using` syntax.
14741475
14751476
### `profiler.start()`
14761477
@@ -1490,7 +1491,7 @@ added:
14901491
- v18.15.0
14911492
-->
14921493
1493-
Stop collecting GC data and return an object.The content of object
1494+
Stop collecting GC data and return an object. The content of object
14941495
is as follows.
14951496
14961497
```json
@@ -1575,6 +1576,14 @@ setTimeout(() => {
15751576
}, 1000);
15761577
```
15771578
1579+
### `profiler[Symbol.dispose]()`
1580+
1581+
<!-- YAML
1582+
added: REPLACEME
1583+
-->
1584+
1585+
Stop collecting GC data, and discard the profile.
1586+
15781587
## Class: `SyncCPUProfileHandle`
15791588
15801589
<!-- YAML
Collapse file

‎lib/v8.js‎

Copy file name to clipboardExpand all lines: lib/v8.js
+4Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -488,6 +488,10 @@ class GCProfiler {
488488
return JSONParse(data);
489489
}
490490
}
491+
492+
[SymbolDispose]() {
493+
this.stop();
494+
}
491495
}
492496

493497
module.exports = {
Collapse file
+26Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
'use strict';
2+
3+
require('../common');
4+
const assert = require('assert');
5+
const { GCProfiler } = require('v8');
6+
7+
{
8+
const profiler = new GCProfiler();
9+
profiler.start();
10+
11+
const result = profiler[Symbol.dispose]();
12+
13+
assert.strictEqual(result, undefined);
14+
assert.strictEqual(profiler.stop(), undefined);
15+
}
16+
17+
{
18+
const profiler = new GCProfiler();
19+
profiler.start();
20+
21+
profiler[Symbol.dispose]();
22+
// Repeat invocations should not throw
23+
profiler[Symbol.dispose]();
24+
25+
assert.strictEqual(profiler.stop(), undefined);
26+
}

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.