-
Notifications
You must be signed in to change notification settings - Fork 776
Add a HeapSnapshotAnalysis pass #7486
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
base: main
Are you sure you want to change the base?
Conversation
Chrome and Edge DevTools can capture heap snapshots, which are JSON representations of the entire object graph at a moment in time. Add a pass that can parse such a snapshot and report statistics about how much of the heap is occupied by Wasm objects and what the top types are by cumulative heap size and allocation count.
I'll add a test for this before we land it. I'm also open to suggestions of interesting analyses to run. I don't have a heap snapshot of a module with a name section, but eventually I would like to support printing details of the type definitions when I can match up names in the snapshot to names in the module. |
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.
Please add a test (unless this is not meant for landing).
#include "support/file.h" | ||
#include "support/json.h" | ||
#include "wasm.h" | ||
|
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.
Please add a comment explaining the pass.
@@ -220,6 +220,10 @@ void PassRegistry::registerPasses() { | |||
createTypeRefiningGUFAPass); | |||
registerPass( | |||
"heap2local", "replace GC allocations with locals", createHeap2LocalPass); | |||
registerPass("heap-snapshot-analysis", | |||
"Ingest a Chrome DevTools heap snapshot and analysize the " |
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.
"Ingest a Chrome DevTools heap snapshot and analysize the " | |
"ingest a Chrome DevTools heap snapshot and analyze the " |
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.
lol "analysize" 😂
@@ -426,6 +437,16 @@ struct Value { | |||
return obj->count(x) > 0; | |||
} | |||
|
|||
Ref maybeGet(IString x) { |
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.
Is this doing JS-like property access on an object? Please add a comment. And, should the if below be an assert perhaps?
Chrome and Edge DevTools can capture heap snapshots, which are JSON
representations of the entire object graph at a moment in time. Add a
pass that can parse such a snapshot and report statistics about how much
of the heap is occupied by Wasm objects and what the top types are by
cumulative heap size and allocation count.