-
Notifications
You must be signed in to change notification settings - Fork 31k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
v8: add v8.getCppHeapStatistics() method #57146
Conversation
0f5a16c to
dac6b7a
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think v8: add v8.getCppHeapStatistics() may be more intuitive as a commit message. Otherwise it might get interpreted as something like "exposing the cppgc::CppHeap::CollectStatistics() symbol" in the binary (for addons) / exposing the headers instead.
src/node_v8.cc
Outdated
|
|
||
| cppgc::HeapStatistics stats = isolate->GetCppHeap()->CollectStatistics( | ||
| static_cast<cppgc::HeapStatistics::DetailLevel>( | ||
| args[0].As<v8::Int32>()->Value())); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: Add using v8::Int32; to the list of other using v8:... items at the top of the namespace and change this to just .As<Int32>()
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Side note... we do this kind of static cast so often we should probably just wrap it in a utility macro.... but no need to do that here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(About that side note, maybe it's even better to wrap them in methods with templated return types for a bit of type checking, the integer types and enums can get especially hairy because there are so many of variants of them, I think FromV8Value<T>() would be very cool)
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #57146 +/- ##
==========================================
- Coverage 90.24% 90.20% -0.05%
==========================================
Files 630 630
Lines 184908 185101 +193
Branches 36181 36196 +15
==========================================
+ Hits 166874 166972 +98
- Misses 11061 11115 +54
- Partials 6973 7014 +41
|
dac6b7a to
b1e245b
Compare
b1e245b to
bee4733
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great! :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Almost there :)
bee4733 to
f49e01e
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM with one small grammar fix
doc/api/v8.md
Outdated
| Retrieves [CppHeap][] regarding memory consumption and | ||
| utilization statistics using the V8 [`CollectStatistics()`][] function which |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| Retrieves [CppHeap][] regarding memory consumption and | |
| utilization statistics using the V8 [`CollectStatistics()`][] function which | |
| Retrieves [CppHeap][] statistics regarding memory consumption and | |
| utilization using the V8 [`CollectStatistics()`][] function which |
|
@Aditi-1400 looks like there is a merge conflict. Can you rebase the PR? |
Expose `CppHeap` data via `cppgc::CppHeap::CollectStatistics()` in the v8 module.
|
Landed in d3064e8 |
Expose `CppHeap` data via `cppgc::CppHeap::CollectStatistics()` in the v8 module. PR-URL: #57146 Fixes: #56533 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Stephen Belanger <admin@stephenbelanger.com> Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
Expose `CppHeap` data via `cppgc::CppHeap::CollectStatistics()` in the v8 module. PR-URL: #57146 Fixes: #56533 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Stephen Belanger <admin@stephenbelanger.com> Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
Notable changes: crypto: * update root certificates to NSS 3.108 (Node.js GitHub Bot) #57381 doc: * add @geeksilva97 to collaborators (Edy Silva) #57241 src: * (SEMVER-MINOR) set default config as node.config.json (Marco Ippolito) #57171 * (SEMVER-MINOR) create THROW_ERR_OPTIONS_BEFORE_BOOTSTRAPPING (Marco Ippolito) #57016 * (SEMVER-MINOR) add config file support (Marco Ippolito) #57016 test_runner: * (SEMVER-MINOR) change ts default glob (Marco Ippolito) #57359 tls: * (SEMVER-MINOR) implement tls.getCACertificates() (Joyee Cheung) #57107 v8: * (SEMVER-MINOR) add v8.getCppHeapStatistics() method (Aditi) #57146 PR-URL: #57424
Notable changes: crypto: * update root certificates to NSS 3.108 (Node.js GitHub Bot) #57381 doc: * add @geeksilva97 to collaborators (Edy Silva) #57241 src: * (SEMVER-MINOR) set default config as node.config.json (Marco Ippolito) #57171 * (SEMVER-MINOR) create THROW_ERR_OPTIONS_BEFORE_BOOTSTRAPPING (Marco Ippolito) #57016 * (SEMVER-MINOR) add config file support (Marco Ippolito) #57016 test_runner: * (SEMVER-MINOR) change ts default glob (Marco Ippolito) #57359 tls: * (SEMVER-MINOR) implement tls.getCACertificates() (Joyee Cheung) #57107 v8: * (SEMVER-MINOR) add v8.getCppHeapStatistics() method (Aditi) #57146 PR-URL: #57424
Notable changes: config: * (SEMVER-MINOR) add config file support (Marco Ippolito) #57016 * (SEMVER-MINOR) set default config as `node.config.json` (Marco Ippolito) #57171 crypto: * update root certificates to NSS 3.108 (Node.js GitHub Bot) #57381 doc: * add geeksilva97 to collaborators (Edy Silva) #57241 src: * (SEMVER-MINOR) create `THROW_ERR_OPTIONS_BEFORE_BOOTSTRAPPING` (Marco Ippolito) #57016 test_runner: * (SEMVER-MINOR) change ts default glob (Marco Ippolito) #57359 tls: * (SEMVER-MINOR) implement `tls.getCACertificates()` (Joyee Cheung) #57107 v8: * (SEMVER-MINOR) add `v8.getCppHeapStatistics()` method (Aditi) #57146 PR-URL: #57424
Notable changes: config: * (SEMVER-MINOR) add config file support (Marco Ippolito) #57016 * (SEMVER-MINOR) set default config as `node.config.json` (Marco Ippolito) #57171 crypto: * update root certificates to NSS 3.108 (Node.js GitHub Bot) #57381 doc: * add geeksilva97 to collaborators (Edy Silva) #57241 src: * (SEMVER-MINOR) create `THROW_ERR_OPTIONS_BEFORE_BOOTSTRAPPING` (Marco Ippolito) #57016 test_runner: * (SEMVER-MINOR) change ts default glob (Marco Ippolito) #57359 tls: * (SEMVER-MINOR) implement `tls.getCACertificates()` (Joyee Cheung) #57107 v8: * (SEMVER-MINOR) add `v8.getCppHeapStatistics()` method (Aditi) #57146 PR-URL: #57424

Formed in 2009, the Archive Team (not to be confused with the archive.org Archive-It Team) is a rogue archivist collective dedicated to saving copies of rapidly dying or deleted websites for the sake of history and digital heritage. The group is 100% composed of volunteers and interested parties, and has expanded into a large amount of related projects for saving online and digital history.

Expose
CppHeapdata viacppgc::CppHeap::CollectStatistics()in the v8 module.Fixes: #56533