Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(202)

Issue 2440393002: [tracing] Implement composable memory usage estimators. (Closed)

Created:
4 years, 1 month ago by Dmitry Skiba
Modified:
4 years, 1 month ago
CC:
chromium-reviews, tracing+reviews_chromium.org, wfh+watch_chromium.org, cc-bugs_chromium.org, Dai Mikurube (NOT FULLTIME)
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

[tracing] Implement composable memory usage estimators. When writing MemoryDumpProviders it's sometimes necessary to know how much memory a particular class is responsible for. The answer is not easy when class' memory usage is spread across several members which use STL containers. This CL introduces EstimateMemoryUsage() family of methods to accurately estimate memory usage of STL containers. I.e. if EstimateMemoryUsage() is implemented for type T, the memory usage of std::map<int, std::vector<T>> is just one EstimateMemoryUsage() call away (instead of two nested loops), and also includes memory used by std::map/vector (which can be big!). The change is needed for sync MDP provider, but can also be used in other MDPs. As an example this CL converts "ui/resource_manager" MDP to use estimators resulting in cleaner code. BUG=649065 CQ_INCLUDE_TRYBOTS=master.tryserver.blink:linux_precise_blink_rel Committed: https://crrev.com/d17ffd41bac39d40a9f351929f1a87ace0775961 Cr-Commit-Position: refs/heads/master@{#431622}

Patch Set 1 #

Patch Set 2 : MSVC support; git cl format #

Patch Set 3 : Fix build issues #

Patch Set 4 : Fix builds differently #

Patch Set 5 : Add accuracy margin. #

Patch Set 6 : Rebase #

Patch Set 7 : Simplify tests #

Total comments: 10

Patch Set 8 : Address comments #

Patch Set 9 : Fix comments, tests. #

Patch Set 10 : Rename to memory_usage_estimator.h #

Patch Set 11 : Estimate unique_ptrs with non-default deleters #

Patch Set 12 : Use ARCH_CPU_64_BITS instead of __LP64__ #

Total comments: 3

Patch Set 13 : Fix strings EMU, instantiate common ones in .cc file #

Patch Set 14 : Add BASE_EXPORT to fix component build #

Patch Set 15 : Rebase #

Unified diffs Side-by-side diffs Delta from patch set Stats (+681 lines, -25 lines) Patch
M base/BUILD.gn View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 2 chunks +3 lines, -0 lines 0 comments Download
A base/trace_event/memory_usage_estimator.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 1 chunk +418 lines, -0 lines 0 comments Download
A base/trace_event/memory_usage_estimator.cc View 1 2 3 4 5 6 7 8 9 10 11 12 1 chunk +14 lines, -0 lines 0 comments Download
A base/trace_event/memory_usage_estimator_unittest.cc View 1 2 3 4 5 6 7 8 9 10 11 1 chunk +229 lines, -0 lines 0 comments Download
M cc/resources/scoped_ui_resource.h View 1 1 chunk +1 line, -3 lines 0 comments Download
M cc/resources/ui_resource_bitmap.h View 1 chunk +1 line, -1 line 0 comments Download
M ui/android/resources/crushed_sprite_resource.h View 1 chunk +1 line, -1 line 0 comments Download
M ui/android/resources/crushed_sprite_resource.cc View 1 chunk +1 line, -1 line 0 comments Download
M ui/android/resources/resource_manager.h View 1 chunk +1 line, -0 lines 0 comments Download
M ui/android/resources/resource_manager.cc View 1 2 3 4 5 6 7 8 9 2 chunks +5 lines, -0 lines 0 comments Download
M ui/android/resources/resource_manager_impl.cc View 1 2 3 4 5 6 7 8 9 2 chunks +7 lines, -19 lines 0 comments Download

Messages

Total messages: 72 (30 generated)
Dmitry Skiba
4 years, 1 month ago (2016-10-24 08:28:07 UTC) #3
Primiano Tucci (use gerrit)
On 2016/10/24 08:28:07, Dmitry Skiba wrote: Ok wait this needs some context. What is the ...
4 years, 1 month ago (2016-10-24 15:03:53 UTC) #4
Dmitry Skiba
On 2016/10/24 15:03:53, Primiano Tucci wrote: > On 2016/10/24 08:28:07, Dmitry Skiba wrote: > > ...
4 years, 1 month ago (2016-10-24 17:13:40 UTC) #5
Primiano Tucci (use gerrit)
There are two fundamental things I don't understand here: 1) This CL introduces a ScopedMemoryUsage ...
4 years, 1 month ago (2016-10-24 17:23:10 UTC) #6
Dmitry Skiba
On 2016/10/24 17:23:10, Primiano Tucci wrote: > There are two fundamental things I don't understand ...
4 years, 1 month ago (2016-10-24 17:57:23 UTC) #7
Dmitry Skiba
Another example: MDP for TabRestorer (http://crbug.com/645123): https://codereview.chromium.org/2451583002 Clean and readable code (see for example components/sessions/core/serialized_navigation_entry.cc). ...
4 years, 1 month ago (2016-10-25 04:55:06 UTC) #8
DmitrySkiba
Re: platform dependency. The idea is to first account for platform differences so that results ...
4 years, 1 month ago (2016-10-27 08:13:53 UTC) #18
DmitrySkiba
So, what do you think? I have two new thoughts: 1. Since we now have ...
4 years, 1 month ago (2016-10-28 00:05:45 UTC) #19
Primiano Tucci (use gerrit)
On 2016/10/28 00:05:45, DmitrySkiba wrote: > So, what do you think? > > I have ...
4 years, 1 month ago (2016-10-28 10:23:24 UTC) #20
DmitrySkiba
On 2016/10/28 10:23:24, Primiano Tucci wrote: > On 2016/10/28 00:05:45, DmitrySkiba wrote: > > So, ...
4 years, 1 month ago (2016-10-28 17:32:53 UTC) #21
DmitrySkiba
Sorry for delay, I'm stability sheriff this week, hopefully I'll get to this tomorrow. BTW, ...
4 years, 1 month ago (2016-11-01 05:20:57 UTC) #22
Primiano Tucci (use gerrit)
On 2016/10/28 17:32:53, DmitrySkiba wrote: > On 2016/10/28 10:23:24, Primiano Tucci wrote: > > On ...
4 years, 1 month ago (2016-11-01 19:04:04 UTC) #23
DmitrySkiba
I see, I think I get your points now: 1. It's the test that adds ...
4 years, 1 month ago (2016-11-03 16:25:22 UTC) #24
DmitrySkiba
Tests simplified, PTAL. Any idea on how to handle 64/32-bit differences? I don't want to ...
4 years, 1 month ago (2016-11-08 05:37:42 UTC) #25
Primiano Tucci (use gerrit)
Ok generally the idea and the new test strategy LGTM. I like the final composability ...
4 years, 1 month ago (2016-11-08 14:09:16 UTC) #27
Primiano Tucci (use gerrit)
On 2016/11/08 05:37:42, DmitrySkiba wrote: > Tests simplified, PTAL. > > Any idea on how ...
4 years, 1 month ago (2016-11-08 14:09:59 UTC) #28
DmitrySkiba
On 2016/11/08 14:09:59, Primiano Tucci - mostly ooo wrote: > On 2016/11/08 05:37:42, DmitrySkiba wrote: ...
4 years, 1 month ago (2016-11-08 17:47:02 UTC) #29
DmitrySkiba
https://codereview.chromium.org/2440393002/diff/120001/base/trace_event/estimate_memory_usage.h File base/trace_event/estimate_memory_usage.h (right): https://codereview.chromium.org/2440393002/diff/120001/base/trace_event/estimate_memory_usage.h#newcode53 base/trace_event/estimate_memory_usage.h:53: // 1. It starts with 'using' declaration. This makes ...
4 years, 1 month ago (2016-11-08 17:47:14 UTC) #30
DmitrySkiba
dtrainor@, ericrk@: guys, please review changes in cc/ and ui/. The changes rename some functions ...
4 years, 1 month ago (2016-11-08 18:41:51 UTC) #32
dcheng
Some random thoughts WRT templates. https://codereview.chromium.org/2440393002/diff/120001/base/trace_event/estimate_memory_usage.h File base/trace_event/estimate_memory_usage.h (right): https://codereview.chromium.org/2440393002/diff/120001/base/trace_event/estimate_memory_usage.h#newcode53 base/trace_event/estimate_memory_usage.h:53: // 1. It starts ...
4 years, 1 month ago (2016-11-08 19:31:48 UTC) #33
DmitrySkiba
On 2016/11/08 19:31:48, dcheng wrote: > Some random thoughts WRT templates. > > https://codereview.chromium.org/2440393002/diff/120001/base/trace_event/estimate_memory_usage.h > ...
4 years, 1 month ago (2016-11-08 22:14:21 UTC) #34
dcheng
On 2016/11/08 22:14:21, DmitrySkiba wrote: > On 2016/11/08 19:31:48, dcheng wrote: > > Some random ...
4 years, 1 month ago (2016-11-09 00:35:51 UTC) #35
DmitrySkiba
On 2016/11/09 00:35:51, dcheng wrote: ... > > It might be possible to get rid ...
4 years, 1 month ago (2016-11-09 01:14:06 UTC) #36
DmitrySkiba
PTAL again. Updated comment to recommend putting EMUs in base::trace_event, and fixed tests on 32/64 ...
4 years, 1 month ago (2016-11-09 06:10:11 UTC) #37
dcheng
LGTM with some nits. My main concern here is around potential binary bloat, since all ...
4 years, 1 month ago (2016-11-10 06:45:46 UTC) #46
Primiano Tucci (use gerrit)
Thanks a lot Daniel for the help here. Still LGTM from my side. On 2016/11/10 ...
4 years, 1 month ago (2016-11-10 11:09:38 UTC) #47
Primiano Tucci (use gerrit)
On 2016/11/10 11:09:38, Primiano Tucci - mostly ooo wrote: > Thanks a lot Daniel for ...
4 years, 1 month ago (2016-11-10 11:10:30 UTC) #48
DmitrySkiba
On 2016/11/10 06:45:46, dcheng wrote: > LGTM with some nits. > > My main concern ...
4 years, 1 month ago (2016-11-10 17:39:08 UTC) #49
DmitrySkiba
Friendly ping dtrainor@, ericrk@: guys, please review changes in cc/ and ui/. The changes rename ...
4 years, 1 month ago (2016-11-10 19:32:37 UTC) #50
David Trainor- moved to gerrit
ui/ lgtm! Thanks!
4 years, 1 month ago (2016-11-10 22:29:50 UTC) #51
ericrk
cc/ LGTM
4 years, 1 month ago (2016-11-10 23:49:53 UTC) #52
dcheng
On 2016/11/10 17:39:08, DmitrySkiba wrote: > On 2016/11/10 06:45:46, dcheng wrote: > > LGTM with ...
4 years, 1 month ago (2016-11-11 00:01:42 UTC) #53
DmitrySkiba
On 2016/11/11 00:01:42, dcheng wrote: > ... > The main thing I'd be worried about ...
4 years, 1 month ago (2016-11-11 01:14:01 UTC) #54
Primiano Tucci (use gerrit)
On 2016/11/11 01:14:01, DmitrySkiba wrote: > On 2016/11/11 00:01:42, dcheng wrote: > > ... > ...
4 years, 1 month ago (2016-11-11 10:17:03 UTC) #55
DmitrySkiba
On 2016/11/11 10:17:03, Primiano Tucci wrote: > On 2016/11/11 01:14:01, DmitrySkiba wrote: > > On ...
4 years, 1 month ago (2016-11-11 16:19:39 UTC) #56
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.org/2440393002/240001
4 years, 1 month ago (2016-11-11 16:20:04 UTC) #59
commit-bot: I haz the power
Try jobs failed on following builders: linux_chromium_compile_dbg_ng on master.tryserver.chromium.linux (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.linux/builders/linux_chromium_compile_dbg_ng/builds/190697)
4 years, 1 month ago (2016-11-11 16:35:55 UTC) #61
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.org/2440393002/260001
4 years, 1 month ago (2016-11-11 17:03:04 UTC) #64
commit-bot: I haz the power
Failed to apply patch for base/BUILD.gn: While running git apply --index -p1; error: patch failed: ...
4 years, 1 month ago (2016-11-11 18:02:24 UTC) #66
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.org/2440393002/280001
4 years, 1 month ago (2016-11-11 19:03:23 UTC) #69
commit-bot: I haz the power
Committed patchset #15 (id:280001)
4 years, 1 month ago (2016-11-11 20:31:14 UTC) #70
commit-bot: I haz the power
4 years, 1 month ago (2016-11-11 21:00:12 UTC) #72
Message was sent while issue was closed.
Patchset 15 (id:??) landed as
https://crrev.com/d17ffd41bac39d40a9f351929f1a87ace0775961
Cr-Commit-Position: refs/heads/master@{#431622}

Powered by Google App Engine
This is Rietveld 408576698