mirror of
https://github.com/dart-lang/sdk
synced 2024-09-15 22:00:09 +00:00
[vm] Add doc for snapshot profiling.
Change-Id: Ib33dffd5d7ad4bb6c3fc9eb83a8b321b6a85495c Reviewed-on: https://dart-review.googlesource.com/c/86024 Auto-Submit: Samir Jindel <sjindel@google.com> Commit-Queue: Vyacheslav Egorov <vegorov@google.com> Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
This commit is contained in:
parent
8cb7ab9567
commit
526b11d28e
19
runtime/docs/snapshot_profiling.md
Normal file
19
runtime/docs/snapshot_profiling.md
Normal file
|
@ -0,0 +1,19 @@
|
|||
# AOT Snapshot Size Profiling
|
||||
|
||||
The VM supports profiling the size of AOT snapshots by leveraging the object-graph based file format introduced by V8.
|
||||
|
||||
## Recording a profile
|
||||
|
||||
To generate a snapshot profile, simply pass the `--write-v8-snapshot-profile-to=<filename>` flag to `gen_snapshot`.
|
||||
The profile will be written in JSON format to the requested file.
|
||||
Make sure to use the ".heapsnaphsot" extension for the file to open it in Chrome DevTools.
|
||||
|
||||
## Examining a profile in Chrome
|
||||
|
||||
Open Chrome DevTools, navigate to the "Memory" tab, right-click on the "Profiles" panel, click Load..." and select the snapshot profile file.
|
||||
See https://developers.google.com/web/tools/chrome-devtools/memory-problems/heap-snapshots for details on how to use the tool.
|
||||
|
||||
## Examining a profile programmatically
|
||||
|
||||
A Dart library to parse the snapshot profile format is provided in `pkg/vm/lib/v8_snaphsot_profile.dart`.
|
||||
The `dart2js_info` package has some useful code for calculating retainers and other graph statistics.
|
Loading…
Reference in a new issue