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

Issue 1417003003: [tracing] Dump child processes' memory metrics in browser (Closed)

Created:
5 years, 1 month ago by ssid
Modified:
4 years, 11 months ago
CC:
chromium-reviews, tracing+reviews_chromium.org, wfh+watch_chromium.org, darin-cc_chromium.org, jam, vmpstr+watch_chromium.org
Base URL:
https://chromium.googlesource.com/chromium/src.git@web_cache2_base
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

[tracing] Dump child processes' memory metrics in browser The sandbox in linux prevents the process from reading the process metrics file. To work around this issue, the browser process will now dump statistics of the child processes too. This requires the composable dumps support in trace viewer and telemetry. This CL makes following changes. 1. Move the process totals and memory maps dump provider into a single header as process_metrics_dump_provider in components/tracing. This is because it is not necessary to have this in base and now the provider knows/manages for different processes. Also the dump method are made to handle error better, since process can vanish while dumping. 2. Make the dump provider non-singleton and have a register / unregister that manages the lifetime of the dump providers. 3. The dump providers unregister using the new UnregisterAndDeleteDumpProviderAsync api added by crrev.com/1430073002. 4. On linux the browser process dumps metrics for all processes and on android the child processes can dump since seccomp sandbox is not enabled in android yet. 5. The proc/status file is human readable stats and is not guaranteed to have a field that is asked for. So, the NOTREACHED is removed in ReadProcStatusAndGetFieldAsSizeT. 6. Since we introduce other process dumps from browser process there could be races while unregistering and dumping. To test this, the browser test is updated. BUG=461788 Committed: https://crrev.com/4d77d76a42425282b1a3c5b7309db9b98e777f60 Cr-Commit-Position: refs/heads/master@{#369482}

Patch Set 1 #

Patch Set 2 : Nits. #

Total comments: 2

Patch Set 3 : no gn. #

Patch Set 4 : Fixes #

Patch Set 5 : tests #

Patch Set 6 : dNits. #

Total comments: 16

Patch Set 7 : Remove manager #

Total comments: 16

Patch Set 8 : rebase. #

Patch Set 9 : Rebase. #

Patch Set 10 : primiano's comments #

Total comments: 42

Patch Set 11 : addressing comments. #

Patch Set 12 : Rebase and fix nacl #

Total comments: 12

Patch Set 13 : Fixes. #

Total comments: 5

Patch Set 14 : Fix header macro. #

Total comments: 3

Patch Set 15 : Adding comment instead of notreached. #

Unified diffs Side-by-side diffs Delta from patch set Stats (+491 lines, -662 lines) Patch
M base/BUILD.gn View 1 2 3 4 5 6 7 8 9 10 11 6 chunks +0 lines, -11 lines 0 comments Download
M base/process/process_metrics_linux.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 1 chunk +2 lines, -1 line 0 comments Download
M base/trace_event/memory_dump_manager.cc View 1 2 3 4 5 6 7 8 9 10 11 2 chunks +0 lines, -18 lines 0 comments Download
D base/trace_event/process_memory_maps_dump_provider.h View 1 2 3 4 5 6 7 8 1 chunk +0 lines, -43 lines 0 comments Download
D base/trace_event/process_memory_maps_dump_provider.cc View 1 2 3 4 5 6 7 8 1 chunk +0 lines, -176 lines 0 comments Download
D base/trace_event/process_memory_maps_dump_provider_unittest.cc View 1 2 3 4 5 6 7 8 1 chunk +0 lines, -190 lines 0 comments Download
D base/trace_event/process_memory_totals_dump_provider.h View 1 2 3 4 5 6 7 8 1 chunk +0 lines, -48 lines 0 comments Download
D base/trace_event/process_memory_totals_dump_provider.cc View 1 2 3 4 5 6 7 8 1 chunk +0 lines, -92 lines 0 comments Download
D base/trace_event/process_memory_totals_dump_provider_unittest.cc View 1 2 3 4 5 6 7 8 1 chunk +0 lines, -48 lines 0 comments Download
M base/trace_event/trace_event.gypi View 1 2 3 4 5 6 7 3 chunks +0 lines, -12 lines 0 comments Download
M chrome/test/base/tracing_browsertest.cc View 1 2 3 4 5 6 7 8 9 10 11 1 chunk +11 lines, -1 line 0 comments Download
M components/components_tests.gyp View 1 2 3 4 5 6 7 8 9 10 11 1 chunk +1 line, -0 lines 0 comments Download
M components/tracing.gyp View 1 2 3 4 5 6 7 8 9 10 11 2 chunks +9 lines, -0 lines 0 comments Download
M components/tracing/BUILD.gn View 1 2 3 4 5 6 7 8 9 10 11 3 chunks +7 lines, -0 lines 0 comments Download
M components/tracing/child_memory_dump_manager_delegate_impl.cc View 1 2 3 4 5 6 7 8 9 10 11 2 chunks +9 lines, -0 lines 0 comments Download
A components/tracing/process_metrics_memory_dump_provider.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 1 chunk +67 lines, -0 lines 0 comments Download
A components/tracing/process_metrics_memory_dump_provider.cc View 1 2 3 4 5 6 7 8 9 10 11 12 1 chunk +305 lines, -0 lines 0 comments Download
A + components/tracing/process_metrics_memory_dump_provider_unittest.cc View 1 2 3 4 5 6 7 8 9 10 11 5 chunks +64 lines, -22 lines 0 comments Download
M content/browser/browser_main_loop.cc View 1 2 3 4 5 6 7 8 9 10 11 2 chunks +3 lines, -0 lines 0 comments Download
M content/browser/tracing/tracing_controller_impl.cc View 1 2 3 4 5 6 7 8 9 10 11 12 3 chunks +13 lines, -0 lines 0 comments Download

Depends on Patchset:

Dependent Patchsets:

Messages

Total messages: 64 (21 generated)
ssid
PTAL, Thanks.
5 years, 1 month ago (2015-11-02 17:50:51 UTC) #2
Primiano Tucci (use gerrit)
this is way more invasive that what it needs to be. The MDM should not ...
5 years, 1 month ago (2015-11-03 15:14:08 UTC) #3
ssid
On 2015/11/03 15:14:08, Primiano Tucci wrote: > this is way more invasive that what it ...
5 years, 1 month ago (2015-11-03 15:59:26 UTC) #4
ssid
WDYT about this?
5 years, 1 month ago (2015-11-10 14:07:03 UTC) #6
Primiano Tucci (use gerrit)
I am going to treview this soon, thanks for the CL. In the meantime, one ...
5 years, 1 month ago (2015-11-13 17:39:39 UTC) #7
ssid
On 2015/11/13 17:39:39, Primiano Tucci wrote: > I am going to treview this soon, thanks ...
5 years, 1 month ago (2015-11-13 17:40:43 UTC) #8
Primiano Tucci (use gerrit)
The approach makes sense. My main objection here is that I'd like to avoid yet ...
5 years, 1 month ago (2015-11-17 10:44:13 UTC) #9
ssid
Also, the UnregisterAsync was failing everytime some process ends. I will debug that once you ...
5 years, 1 month ago (2015-11-17 11:13:07 UTC) #10
Primiano Tucci (use gerrit)
> This would mean that there is a global std::map (not ScopedPtrMap) of the > ...
5 years, 1 month ago (2015-11-17 11:30:30 UTC) #11
ssid
thanks ptal. https://codereview.chromium.org/1417003003/diff/100001/base/trace_event/trace_event.gypi File base/trace_event/trace_event.gypi (left): https://codereview.chromium.org/1417003003/diff/100001/base/trace_event/trace_event.gypi#oldcode95 base/trace_event/trace_event.gypi:95: 'trace_event/process_memory_maps_dump_provider_unittest.cc', On 2015/11/17 10:44:12, Primiano Tucci wrote: ...
5 years, 1 month ago (2015-11-17 13:55:06 UTC) #12
Primiano Tucci (use gerrit)
LGTM with some final comment (please address them). I wonder how we are going to ...
5 years ago (2015-12-14 10:52:21 UTC) #14
ssid
Check diff with last patchset for a little clean diff of changes without rebase noise. ...
4 years, 11 months ago (2016-01-04 20:54:38 UTC) #18
ssid
Oh, I forgot. I also added points 5 and 6 of the description after your ...
4 years, 11 months ago (2016-01-04 21:01:35 UTC) #19
Primiano Tucci (use gerrit)
Other review round. We're close :) Everything looks fine, but I've some smaller comments here ...
4 years, 11 months ago (2016-01-05 11:55:17 UTC) #20
ssid
I have addressed comments as much as possible. Please see replies inline. PTAL, thanks. https://codereview.chromium.org/1417003003/diff/200001/base/BUILD.gn ...
4 years, 11 months ago (2016-01-06 20:26:34 UTC) #26
Primiano Tucci (use gerrit)
Excellent! final LGTM with few last comments. Sorry for the back and forth on base/, ...
4 years, 11 months ago (2016-01-07 11:34:35 UTC) #27
ssid
Thanks, i made this cl depend on https://codereview.chromium.org/1553183002/ and will finish that first. https://codereview.chromium.org/1417003003/diff/340001/base/process/process_metrics_linux.cc File ...
4 years, 11 months ago (2016-01-07 13:03:10 UTC) #28
ssid
+thakis for changes in process_metrics_linux.cc. I removed a NOTREACHED (see description point 5). And chrome/test/base/tracing_browsertest.cc ...
4 years, 11 months ago (2016-01-07 13:10:36 UTC) #30
dsinclair
passing over to simonhatch@.
4 years, 11 months ago (2016-01-07 14:30:35 UTC) #32
Primiano Tucci (use gerrit)
Also +sievers for 3 lines change in content/browser/browser_main_loop.cc
4 years, 11 months ago (2016-01-07 14:47:33 UTC) #34
shatch
components/tracing lgtm https://codereview.chromium.org/1417003003/diff/360001/components/tracing/process_metrics_memory_dump_provider.cc File components/tracing/process_metrics_memory_dump_provider.cc (right): https://codereview.chromium.org/1417003003/diff/360001/components/tracing/process_metrics_memory_dump_provider.cc#newcode24 components/tracing/process_metrics_memory_dump_provider.cc:24: #include "build/build_config.h" nit: Some stuff included here ...
4 years, 11 months ago (2016-01-07 15:52:58 UTC) #35
no sievers
On 2016/01/07 14:47:33, Primiano Tucci wrote: > Also +sievers for 3 lines change in content/browser/browser_main_loop.cc ...
4 years, 11 months ago (2016-01-07 17:54:54 UTC) #36
ssid
@shatch, thanks see replies inline. https://codereview.chromium.org/1417003003/diff/360001/components/tracing/process_metrics_memory_dump_provider.cc File components/tracing/process_metrics_memory_dump_provider.cc (right): https://codereview.chromium.org/1417003003/diff/360001/components/tracing/process_metrics_memory_dump_provider.cc#newcode24 components/tracing/process_metrics_memory_dump_provider.cc:24: #include "build/build_config.h" On 2016/01/07 ...
4 years, 11 months ago (2016-01-07 19:25:24 UTC) #37
shatch
https://codereview.chromium.org/1417003003/diff/360001/components/tracing/process_metrics_memory_dump_provider.cc File components/tracing/process_metrics_memory_dump_provider.cc (right): https://codereview.chromium.org/1417003003/diff/360001/components/tracing/process_metrics_memory_dump_provider.cc#newcode24 components/tracing/process_metrics_memory_dump_provider.cc:24: #include "build/build_config.h" On 2016/01/07 19:25:24, ssid wrote: > On ...
4 years, 11 months ago (2016-01-07 19:36:56 UTC) #38
Nico
https://codereview.chromium.org/1417003003/diff/380001/base/process/process_metrics_linux.cc File base/process/process_metrics_linux.cc (left): https://codereview.chromium.org/1417003003/diff/380001/base/process/process_metrics_linux.cc#oldcode89 base/process/process_metrics_linux.cc:89: NOTREACHED(); is there test coverage for this change?
4 years, 11 months ago (2016-01-08 00:45:52 UTC) #39
ssid
https://codereview.chromium.org/1417003003/diff/380001/base/process/process_metrics_linux.cc File base/process/process_metrics_linux.cc (left): https://codereview.chromium.org/1417003003/diff/380001/base/process/process_metrics_linux.cc#oldcode89 base/process/process_metrics_linux.cc:89: NOTREACHED(); On 2016/01/08 00:45:52, Nico wrote: > is there ...
4 years, 11 months ago (2016-01-08 11:26:01 UTC) #40
Nico
https://codereview.chromium.org/1417003003/diff/380001/base/process/process_metrics_linux.cc File base/process/process_metrics_linux.cc (left): https://codereview.chromium.org/1417003003/diff/380001/base/process/process_metrics_linux.cc#oldcode89 base/process/process_metrics_linux.cc:89: NOTREACHED(); On 2016/01/08 11:26:01, ssid wrote: > On 2016/01/08 ...
4 years, 11 months ago (2016-01-08 16:07:34 UTC) #41
ssid
On 2016/01/08 16:07:34, Nico wrote: > https://codereview.chromium.org/1417003003/diff/380001/base/process/process_metrics_linux.cc > File base/process/process_metrics_linux.cc (left): > > https://codereview.chromium.org/1417003003/diff/380001/base/process/process_metrics_linux.cc#oldcode89 > ...
4 years, 11 months ago (2016-01-08 16:10:39 UTC) #42
ssid
On 2016/01/08 16:10:39, ssid wrote: > On 2016/01/08 16:07:34, Nico wrote: > > > https://codereview.chromium.org/1417003003/diff/380001/base/process/process_metrics_linux.cc ...
4 years, 11 months ago (2016-01-08 16:12:46 UTC) #43
Primiano Tucci (use gerrit)
On 2016/01/08 16:07:34, Nico wrote: > I mean, is this path now taken while it ...
4 years, 11 months ago (2016-01-08 16:13:49 UTC) #44
Nico
if the existing browser tests reliably hit this, that's good enough for me, lgtm, thanks.
4 years, 11 months ago (2016-01-08 16:18:11 UTC) #45
ssid
No, the test does not hit reliably. Just had an offline discussion with primiano about ...
4 years, 11 months ago (2016-01-08 16:31:16 UTC) #46
Nico
is there a way to discover that a file read from below /proc is truncated ...
4 years, 11 months ago (2016-01-08 18:24:59 UTC) #47
ssid1
On 2016/01/08 18:24:59, Nico wrote: > is there a way to discover that a file ...
4 years, 11 months ago (2016-01-08 18:38:17 UTC) #48
Nico
Hm, maybe put in a comment "// This can be reached if a process dies ...
4 years, 11 months ago (2016-01-08 19:03:34 UTC) #49
commit-bot: I haz the power
Dry run: CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1417003003/400001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1417003003/400001
4 years, 11 months ago (2016-01-14 17:12:38 UTC) #52
commit-bot: I haz the power
Dry run: This issue passed the CQ dry run.
4 years, 11 months ago (2016-01-14 18:35:09 UTC) #54
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1417003003/400001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1417003003/400001
4 years, 11 months ago (2016-01-14 18:37:22 UTC) #57
commit-bot: I haz the power
Committed patchset #15 (id:400001)
4 years, 11 months ago (2016-01-14 18:44:32 UTC) #59
commit-bot: I haz the power
Patchset 15 (id:??) landed as https://crrev.com/4d77d76a42425282b1a3c5b7309db9b98e777f60 Cr-Commit-Position: refs/heads/master@{#369482}
4 years, 11 months ago (2016-01-14 18:46:07 UTC) #61
huangs
A revert of this CL (patchset #15 id:400001) has been created in https://codereview.chromium.org/1586893003/ by huangs@chromium.org. ...
4 years, 11 months ago (2016-01-14 20:54:52 UTC) #62
Primiano Tucci (use gerrit)
On 2016/01/14 20:54:52, huangs wrote: > A revert of this CL (patchset #15 id:400001) has ...
4 years, 11 months ago (2016-01-14 21:04:55 UTC) #63
ssid
4 years, 11 months ago (2016-01-14 21:08:47 UTC) #64
Message was sent while issue was closed.
On 2016/01/14 21:04:55, Primiano Tucci wrote:
> On 2016/01/14 20:54:52, huangs wrote:
> > A revert of this CL (patchset #15 id:400001) has been created in
> > https://codereview.chromium.org/1586893003/ by mailto:huangs@chromium.org.
> > 
> > The reason for reverting is: This is suspected by Findit to cause failure in
> > TracingBrowserTest.TestMemoryInfra under Mac ASan 64 Tests (1)..
> 
> Link to the failure? Usually you want to put in the revert message or in a bug
> attached to that when you revert.
> Please see
> https://www.chromium.org/developers/tree-sheriffs/sheriff-details-chromium

I can't see why this is related but i could find
e463401bc88116d770ba6ed209f9066a84155a4c was related to gpu. But mine is more
suspicious to cause errors.

Link:
https://build.chromium.org/p/chromium.memory/builders/Mac%20ASan%2064%20Tests...

Powered by Google App Engine
This is Rietveld 408576698