Bug 155188 - Web Inspector: Add a way to create a Heap Snapshot
Summary: Web Inspector: Add a way to create a Heap Snapshot
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Web Inspector (show other bugs)
Version: WebKit Nightly Build
Hardware: All All
: P2 Normal
Assignee: Joseph Pecoraro
URL:
Keywords: InRadar
Depends on:
Blocks: 155190
  Show dependency treegraph
 
Reported: 2016-03-08 13:25 PST by Joseph Pecoraro
Modified: 2016-03-08 17:59 PST (History)
12 users (show)

See Also:


Attachments
[PATCH] Proposed Fix (23.11 KB, patch)
2016-03-08 13:28 PST, Joseph Pecoraro
no flags Details | Formatted Diff | Diff
[PATCH] Proposed Fix (23.98 KB, patch)
2016-03-08 13:42 PST, Joseph Pecoraro
no flags Details | Formatted Diff | Diff
[PATCH] Proposed Fix (24.02 KB, patch)
2016-03-08 13:53 PST, Joseph Pecoraro
no flags Details | Formatted Diff | Diff
[PATCH] Proposed Fix (24.02 KB, patch)
2016-03-08 14:26 PST, Joseph Pecoraro
bburg: review+
Details | Formatted Diff | Diff
[PATCH] For Landing (24.08 KB, patch)
2016-03-08 16:47 PST, Joseph Pecoraro
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Joseph Pecoraro 2016-03-08 13:25:25 PST
* SUMMARY
Add a way to create a Heap Snapshot.

HeapAgent.snapshot => (error, timestamp, snapshotData)
Comment 1 Radar WebKit Bug Importer 2016-03-08 13:26:01 PST
<rdar://problem/25042222>
Comment 2 Joseph Pecoraro 2016-03-08 13:28:25 PST
Created attachment 273322 [details]
[PATCH] Proposed Fix
Comment 3 Joseph Pecoraro 2016-03-08 13:42:58 PST
Created attachment 273324 [details]
[PATCH] Proposed Fix
Comment 4 Joseph Pecoraro 2016-03-08 13:53:28 PST
Created attachment 273334 [details]
[PATCH] Proposed Fix
Comment 5 Joseph Pecoraro 2016-03-08 14:26:12 PST
Created attachment 273341 [details]
[PATCH] Proposed Fix
Comment 6 BJ Burg 2016-03-08 16:39:56 PST
Comment on attachment 273341 [details]
[PATCH] Proposed Fix

View in context: https://bugs.webkit.org/attachment.cgi?id=273341&action=review

very clean. r=me

> LayoutTests/inspector/heap/snapshot.html:22
> +                resolve();

I'm assuming these magic numbers come from builtins / injected scripts?

> Source/JavaScriptCore/inspector/protocol/Heap.json:18
> +            "type": "string"

I am tempted to add JSON and base64 to the protocol, if we add more uses (which we will).

> Source/WebInspectorUI/UserInterface/Models/HeapSnapshot.js:88
> +            let nodePayload = nodes[i];

I assume this loop body is what led you to complain about slow array restructuring.

> Source/WebInspectorUI/UserInterface/Models/HeapSnapshot.js:116
> +        console.assert(rootNode, "Node with identifier 0 is the artificial <root> node.");

s/artificial/synthetic/

> Source/WebInspectorUI/UserInterface/Models/HeapSnapshotEdge.js:30
> +        this.from = from;

Might be worth adding a comment saying this is a directed edge between two HeapSnapshotNodes, 'to' and 'from'. Adding assertions to that effect is probably a perf problem.
Comment 7 Joseph Pecoraro 2016-03-08 16:43:52 PST
Comment on attachment 273341 [details]
[PATCH] Proposed Fix

View in context: https://bugs.webkit.org/attachment.cgi?id=273341&action=review

>> LayoutTests/inspector/heap/snapshot.html:22
>> +                resolve();
> 
> I'm assuming these magic numbers come from builtins / injected scripts?

Nope, the magic numbers are just low ball estimates to ensure they are not 0. The heap size should be at least 1kb for a page, with at least 100 objects (all the builtin APIs), and at least one "Window".

>> Source/JavaScriptCore/inspector/protocol/Heap.json:18
>> +            "type": "string"
> 
> I am tempted to add JSON and base64 to the protocol, if we add more uses (which we will).

Yeah, I considered this! Worth adding in the future for sure.

>> Source/WebInspectorUI/UserInterface/Models/HeapSnapshot.js:88
>> +            let nodePayload = nodes[i];
> 
> I assume this loop body is what led you to complain about slow array restructuring.

Correct.

>> Source/WebInspectorUI/UserInterface/Models/HeapSnapshotEdge.js:30
>> +        this.from = from;
> 
> Might be worth adding a comment saying this is a directed edge between two HeapSnapshotNodes, 'to' and 'from'. Adding assertions to that effect is probably a perf problem.

Yes, adding an assert was a performance problem.
Comment 8 Joseph Pecoraro 2016-03-08 16:47:48 PST
Created attachment 273367 [details]
[PATCH] For Landing
Comment 9 WebKit Commit Bot 2016-03-08 17:38:30 PST
Comment on attachment 273367 [details]
[PATCH] For Landing

Clearing flags on attachment: 273367

Committed r197822: <http://trac.webkit.org/changeset/197822>