Bug 107262 - Web Inspector: Native Memory Instrumentation: assign class name to the heap graph node automatically
Summary: Web Inspector: Native Memory Instrumentation: assign class name to the heap g...
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: Ilya Tikhonovsky
URL:
Keywords:
Depends on:
Blocks: 107254
  Show dependency treegraph
 
Reported: 2013-01-18 05:06 PST by Ilya Tikhonovsky
Modified: 2013-02-06 05:31 PST (History)
15 users (show)

See Also:


Attachments
Patch (3.98 KB, patch)
2013-01-18 05:53 PST, Ilya Tikhonovsky
no flags Details | Formatted Diff | Diff
Patch (3.98 KB, patch)
2013-01-18 06:06 PST, Ilya Tikhonovsky
no flags Details | Formatted Diff | Diff
Patch (7.15 KB, patch)
2013-01-18 07:47 PST, Ilya Tikhonovsky
no flags Details | Formatted Diff | Diff
Patch (7.37 KB, patch)
2013-01-18 08:23 PST, Ilya Tikhonovsky
no flags Details | Formatted Diff | Diff
screenshot of Native Memory Snapshot for Angry Birds (1.07 MB, image/png)
2013-01-18 09:30 PST, Ilya Tikhonovsky
no flags Details
Patch (8.19 KB, patch)
2013-01-18 09:42 PST, Ilya Tikhonovsky
no flags Details | Formatted Diff | Diff
Patch (8.10 KB, patch)
2013-01-18 09:43 PST, Ilya Tikhonovsky
no flags Details | Formatted Diff | Diff
Patch (9.50 KB, patch)
2013-02-02 05:16 PST, Ilya Tikhonovsky
no flags Details | Formatted Diff | Diff
Patch (9.48 KB, patch)
2013-02-02 05:40 PST, Ilya Tikhonovsky
no flags Details | Formatted Diff | Diff
Patch (9.42 KB, patch)
2013-02-04 04:29 PST, Ilya Tikhonovsky
no flags Details | Formatted Diff | Diff
with fix for windows bot (9.84 KB, patch)
2013-02-04 06:19 PST, Ilya Tikhonovsky
no flags Details | Formatted Diff | Diff
with small fix for msvc version (9.80 KB, patch)
2013-02-04 23:51 PST, Ilya Tikhonovsky
no flags Details | Formatted Diff | Diff
comments addressed (10.55 KB, patch)
2013-02-06 01:00 PST, Ilya Tikhonovsky
no flags Details | Formatted Diff | Diff
comments addressed (10.94 KB, patch)
2013-02-06 01:34 PST, Ilya Tikhonovsky
yurys: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Ilya Tikhonovsky 2013-01-18 05:06:23 PST
I found that class name could be calculated automatically even if we have no-rtti.

patch to follow.
Comment 1 Ilya Tikhonovsky 2013-01-18 05:53:39 PST
Created attachment 183434 [details]
Patch
Comment 2 Yury Semikhatsky 2013-01-18 06:02:17 PST
Comment on attachment 183434 [details]
Patch

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

How does it affect the binary size?

> Source/WTF/wtf/MemoryInstrumentation.cpp:140
> +    buffer[length] = 0;

You may be writing to buffer[maxLength] here which is out of the array bounds.
Comment 3 Ilya Tikhonovsky 2013-01-18 06:06:47 PST
Created attachment 183437 [details]
Patch
Comment 4 Ilya Tikhonovsky 2013-01-18 06:07:37 PST
comments addressed.

the footprint is about 174240 bytes. 0.1% of binary size.
Comment 5 Build Bot 2013-01-18 06:31:01 PST
Comment on attachment 183437 [details]
Patch

Attachment 183437 [details] did not pass win-ews (win):
Output: http://queues.webkit.org/results/15938657
Comment 6 Yury Semikhatsky 2013-01-18 06:37:08 PST
(In reply to comment #4)
> comments addressed.
> 
> the footprint is about 174240 bytes. 0.1% of binary size.

We may want put this behind a preprocessor guard to avoid the overhead when the data is not used.
Comment 7 Yury Semikhatsky 2013-01-18 06:45:37 PST
Comment on attachment 183437 [details]
Patch

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

> Source/WTF/ChangeLog:6
> +        Reviewed by NOBODY (OOPS!).

Please add an explanation on why need this change.
Comment 8 Build Bot 2013-01-18 07:45:11 PST
Comment on attachment 183437 [details]
Patch

Attachment 183437 [details] did not pass mac-ews (mac):
Output: http://queues.webkit.org/results/15947452

New failing tests:
inspector/profiler/memory-instrumentation-cached-images.html
Comment 9 Ilya Tikhonovsky 2013-01-18 07:47:02 PST
Created attachment 183458 [details]
Patch
Comment 10 Ilya Tikhonovsky 2013-01-18 08:23:12 PST
Created attachment 183465 [details]
Patch
Comment 11 Build Bot 2013-01-18 09:17:59 PST
Comment on attachment 183465 [details]
Patch

Attachment 183465 [details] did not pass win-ews (win):
Output: http://queues.webkit.org/results/15945575
Comment 12 Build Bot 2013-01-18 09:26:55 PST
Comment on attachment 183465 [details]
Patch

Attachment 183465 [details] did not pass mac-wk2-ews (mac-wk2):
Output: http://queues.webkit.org/results/15939667

New failing tests:
inspector/profiler/memory-instrumentation-cached-images.html
Comment 13 Ilya Tikhonovsky 2013-01-18 09:30:25 PST
Created attachment 183483 [details]
screenshot of Native Memory Snapshot for Angry Birds

The final version looks like this.

Interesting facts:

Instrumentation collects data about 76MB of memory.
It is not included V8 memory.
About half of that memory is used for audio Head-related transfer function.
Inspector may affect inspected page memory with his overlay page which is used by Elements panel.
It uses about 13 MB for images.
Comment 14 Ilya Tikhonovsky 2013-01-18 09:34:22 PST
It doesn't include V8 memory _yet_.
Comment 15 Ilya Tikhonovsky 2013-01-18 09:42:09 PST
Created attachment 183485 [details]
Patch
Comment 16 Ilya Tikhonovsky 2013-01-18 09:43:44 PST
Created attachment 183486 [details]
Patch
Comment 17 Build Bot 2013-01-18 12:21:36 PST
Comment on attachment 183486 [details]
Patch

Attachment 183486 [details] did not pass mac-ews (mac):
Output: http://queues.webkit.org/results/15938769

New failing tests:
inspector/profiler/memory-instrumentation-cached-images.html
Comment 18 Build Bot 2013-01-18 13:20:52 PST
Comment on attachment 183486 [details]
Patch

Attachment 183486 [details] did not pass mac-ews (mac):
Output: http://queues.webkit.org/results/15938793

New failing tests:
inspector/profiler/memory-instrumentation-cached-images.html
Comment 19 Build Bot 2013-01-18 14:56:53 PST
Comment on attachment 183486 [details]
Patch

Attachment 183486 [details] did not pass mac-wk2-ews (mac-wk2):
Output: http://queues.webkit.org/results/15940875

New failing tests:
inspector/profiler/memory-instrumentation-cached-images.html
Comment 20 Yury Semikhatsky 2013-02-01 03:22:38 PST
(In reply to comment #4)
> comments addressed.
> 
> the footprint is about 174240 bytes. 0.1% of binary size.

How come it is way bigger than the size of all edge names which according to   https://bugs.webkit.org/show_bug.cgi?id=107369#c14 increased the binary size just by 20120 bytes. Given that there are more instrumented fields than instrumented classes I believe we can reduce the overhead.
Comment 21 Ilya Tikhonovsky 2013-02-02 05:16:13 PST
Created attachment 186225 [details]
Patch
Comment 22 Ilya Tikhonovsky 2013-02-02 05:30:20 PST
(In reply to comment #21)
> Created an attachment (id=186225) [details]
> Patch

I made an investigation and found that we calculates the class names for 624 classes, instrumented and not instrumented.

I reduced the signature of the function and moved the type independent code from the header to cpp. As a result the patch adds to the binary about 114k.

We could reduce the footprint of the instrumentation but it should be a separate patch.
Comment 23 Ilya Tikhonovsky 2013-02-02 05:40:06 PST
Created attachment 186227 [details]
Patch
Comment 24 Build Bot 2013-02-02 07:15:18 PST
Comment on attachment 186227 [details]
Patch

Attachment 186227 [details] did not pass win-ews (win):
Output: http://queues.webkit.org/results/16340819
Comment 25 Build Bot 2013-02-02 07:39:33 PST
Comment on attachment 186227 [details]
Patch

Attachment 186227 [details] did not pass mac-ews (mac):
Output: http://queues.webkit.org/results/16342789

New failing tests:
inspector/profiler/memory-instrumentation-cached-images.html
Comment 26 Build Bot 2013-02-02 07:46:36 PST
Comment on attachment 186227 [details]
Patch

Attachment 186227 [details] did not pass mac-wk2-ews (mac-wk2):
Output: http://queues.webkit.org/results/16336828

New failing tests:
inspector/profiler/memory-instrumentation-cached-images.html
Comment 27 Ilya Tikhonovsky 2013-02-04 04:29:08 PST
Created attachment 186348 [details]
Patch
Comment 28 Build Bot 2013-02-04 06:13:13 PST
Comment on attachment 186348 [details]
Patch

Attachment 186348 [details] did not pass win-ews (win):
Output: http://queues.webkit.org/results/16370196
Comment 29 Ilya Tikhonovsky 2013-02-04 06:19:21 PST
Created attachment 186365 [details]
with fix for windows bot
Comment 30 Eric Seidel (no email) 2013-02-04 08:33:08 PST
Comment on attachment 186365 [details]
with fix for windows bot

How much does this change binary size?  The reason why we disabled RTTI was that it reduced our binary size by 1/3rd :)
Comment 31 Ilya Tikhonovsky 2013-02-04 21:28:05 PST
(In reply to comment #30)
> (From update of attachment 186365 [details])
> How much does this change binary size?  The reason why we disabled RTTI was that it reduced our binary size by 1/3rd :)

it is about 119.5MB at the moment. So with this patch it will increase by 0.09%
Comment 32 Ilya Tikhonovsky 2013-02-04 22:10:13 PST
(In reply to comment #31)
> (In reply to comment #30)
> > (From update of attachment 186365 [details] [details])
> > How much does this change binary size?  The reason why we disabled RTTI was that it reduced our binary size by 1/3rd :)
> 
> it is about 119.5MB at the moment. So with this patch it will increase by 0.09%

According to the build-bot data  http://build.chromium.org/f/chromium/perf/xp-release/sizes/report.html?history=150&rev=-1&graph=chrome.dll the size on win32 is about 54MB.

Yeah, I know this side effect of RTTI flag :)

The alternative solution is to hardcode the class names in reportMemoryUsage and use <unknown> class name for the classes without instrumentation. Also template container class names will loose details like HashSet instead of HashSet<AnObject>.
Comment 33 Ilya Tikhonovsky 2013-02-04 23:51:01 PST
Created attachment 186558 [details]
with small fix for msvc version
Comment 34 Yury Semikhatsky 2013-02-05 07:49:11 PST
Comment on attachment 186558 [details]
with small fix for msvc version

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

> Source/WTF/wtf/MemoryInstrumentation.h:-226
> -    callReportObjectInfo(memoryObjectInfo, object, 0, sizeof(T));

callReportObjectInfo seems to be unused, can we remove it?

> Source/WTF/wtf/MemoryInstrumentation.h:254
> +    WTF_EXPORT_PRIVATE static void setInfo(MemoryObjectInfo*, const void* pointer, const char* stringWithClassName, MemoryObjectType, size_t actualSize);

maybe callReportObjectInfo ?
Comment 35 Ilya Tikhonovsky 2013-02-06 01:00:19 PST
Created attachment 186778 [details]
comments addressed
Comment 36 Yury Semikhatsky 2013-02-06 01:23:38 PST
Comment on attachment 186778 [details]
comments addressed

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

> Source/WTF/wtf/MemoryInstrumentation.cpp:-64
> -    memoryObjectInfo->reportObjectInfo(pointer, objectType, objectSize);

You need to remove it from header as well.
Comment 37 Ilya Tikhonovsky 2013-02-06 01:34:05 PST
Created attachment 186785 [details]
comments addressed
Comment 38 Ilya Tikhonovsky 2013-02-06 05:31:13 PST
Committed r141992: <http://trac.webkit.org/changeset/141992>