Bug 38420 - Web Inspector: JSC should provide heap size info for Timeline panel
Summary: Web Inspector: JSC should provide heap size info for Timeline panel
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Web Inspector (Deprecated) (show other bugs)
Version: 528+ (Nightly build)
Hardware: All All
: P2 Normal
Assignee: Nobody
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-05-01 03:38 PDT by Ilya Tikhonovsky
Modified: 2010-05-15 01:46 PDT (History)
9 users (show)

See Also:


Attachments
[patch] initial version. (11.83 KB, patch)
2010-05-14 06:06 PDT, Ilya Tikhonovsky
no flags Details | Formatted Diff | Diff
[patch] second iteration. With fixed case of JSDOMWindow.h (11.83 KB, patch)
2010-05-14 07:37 PDT, Ilya Tikhonovsky
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Ilya Tikhonovsky 2010-05-01 03:38:24 PDT
%SUBJ%
Comment 1 Pavel Feldman 2010-05-12 23:46:04 PDT
Can we do something like this as a short term solution?

JSGlobalData* globalData = JSDOMWindow::commonJSGlobalData();
Statistics statistics = globalData->heap.statistics();
Use statistics.size & statistics.free?

It'll traverse heap, but is there anything that works faster for you guys?
Comment 2 Geoffrey Garen 2010-05-13 10:28:45 PDT
I think it's better not to traverse the heap. In the worst case, the heap traversal can be more expensive than the page load itself, so there's a big risk of measurement overhead ruining the timeline.

How about just using m_heap.usedBlocks * BLOCK_SIZE? That's a constant-time measurement of the size of the heap, which should be good enough for general measurement. (statistics() goes farther and gets exact counts of what's live and dead, but that's really only useful for debugging memory leaks in WebKit.)

There's no current accessor for m_heap.usedBlocks * BLOCK_SIZE, but it would be trivial to add one.

size_t Heap::size() // In bytes.
{
    return m_heap.usedBlocks * BLOCK_SIZE;
}
Comment 3 Ilya Tikhonovsky 2010-05-14 06:06:41 PDT
Created attachment 56064 [details]
[patch] initial version.

I've made recommended implementation.
But from the other hand I've made some investigation and found that the heap traversing is eating not more than 0.1 ms for 60mb heap.
Comment 4 WebKit Review Bot 2010-05-14 07:16:38 PDT
Attachment 56064 [details] did not build on gtk:
Build output: http://webkit-commit-queue.appspot.com/results/2282074
Comment 5 Ilya Tikhonovsky 2010-05-14 07:37:00 PDT
Created attachment 56068 [details]
[patch] second iteration. With fixed case of JSDOMWindow.h
Comment 6 Geoffrey Garen 2010-05-14 09:53:05 PDT
Comment on attachment 56068 [details]
[patch] second iteration. With fixed case of JSDOMWindow.h

r=me

That .1ms number is interesting. Perhaps we should reconsider the heap traversal option if there's a big benefit in terms of WebInspector UI.
Comment 7 WebKit Commit Bot 2010-05-15 01:46:34 PDT
Comment on attachment 56068 [details]
[patch] second iteration. With fixed case of JSDOMWindow.h

Clearing flags on attachment: 56068

Committed r59526: <http://trac.webkit.org/changeset/59526>
Comment 8 WebKit Commit Bot 2010-05-15 01:46:40 PDT
All reviewed patches have been landed.  Closing bug.