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

Issue 2386123003: Add heap allocator usage to task profiler. (Closed)

Created:
4 years, 2 months ago by Sigurður Ásgeirsson
Modified:
4 years ago
CC:
chromium-reviews, ssid
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

Add heap allocator usage to task profiler. This enables heap tracking in the task profiler (chrome://profiler) under a build flag, which is enabled for developer builds, but disabled for official builds for now. As-is, this surfaces the following heap metrics per task by default: - Avg number of allocations per run. - Avg number of frees per run. - Avg net bytes allocated (or freed if negative). - Max allocated bytes at any time in any run. This is a high-watermark for memory usage in the task. Additionally it's possible to enable the following metrics by ticking a checkbox in chrome://profiler: - Allocation count. - Free count. A running count of how many allocations and frees a task has performed in all runs. - Allocated bytes. - Freed bytes. A running tally of how many bytes a task has allocated and freed in all runs. - Overhead bytes. An estimate of how many allocated bytes go to heap overhead. This might be helpful to guide implementation to use larger allocations or chunked data structures like std::vector BUG=644385 CQ_INCLUDE_TRYBOTS=master.tryserver.chromium.linux:closure_compilation Committed: https://crrev.com/de38d0cc1f554562dc9062c97079585cc6522fe7 Cr-Commit-Position: refs/heads/master@{#436003}

Patch Set 1 #

Patch Set 2 : Plumb data through to chrome://profiler UI. #

Patch Set 3 : WIP: Expose net usage, misc tweaks. #

Patch Set 4 : WIP: upload for fdoray@ #

Patch Set 5 : Figure out where the @#$%! corruption is coming from. Move heap tracking to TaskStopwatch." #

Total comments: 24

Patch Set 6 : Address Primiano's comments. #

Patch Set 7 : Merge with ToT and https://codereview.chromium.org/2421243003/ #

Patch Set 8 : Push rename through + cleanup. Merge to ToT. #

Patch Set 9 : Cosmetic cleanup. #

Patch Set 10 : Add a build flag to enable or disable memory profiling in the task profiler. #

Patch Set 11 : Move heap tracking initialization to the tracked_object init, engage marshaling. #

Patch Set 12 : Fix initialization of heap tracking. #

Patch Set 13 : Revert an uneccessary security policy override. #

Patch Set 14 : Fix Clang compile (hopefully). #

Patch Set 15 : Endow DeathDataSnapshot with a non-inlined constructor, per Clang's demand. #

Patch Set 16 : Fix remaining clang compile errors. #

Total comments: 14

Patch Set 17 : Address HTML presubmit nits. #

Patch Set 18 : Address Primiano's comments. #

Patch Set 19 : Fix self-reinitialization on thread exit which was barfing all the tests. #

Patch Set 20 : Make ThreadHeapUsage alloc/free symmetrical, fix TaskProfilerDataSerializerTest. #

Patch Set 21 : Reformat. #

Patch Set 22 : Disable ThreadChecker to eliminate it as cause for test failure fallout. #

Patch Set 23 : Revert ThreadChecker disabling. #

Patch Set 24 : Disable memory profiling for NaCL, dummy! #

Patch Set 25 : Fix borked define flag. #

Total comments: 4

Patch Set 26 : Merge in the tcp_socket_win.cc fix. #

Patch Set 27 : Address Primiano's comments, re-enable that irksome DCHECK, now that the fix is in. #

Total comments: 8

Patch Set 28 : Address Daniel's comments. #

Patch Set 29 : Fix DeathData member initialization order. #

Patch Set 30 : Unbreak snapshots by adding the new averages to the exceptions array. #

Patch Set 31 : Now fix snapshots, not merely unbreak them. #

Total comments: 4

Patch Set 32 : Move SaturatingMemberAdd per Nico's comment. #

Total comments: 2

Patch Set 33 : Address Eric's comment. #

Unified diffs Side-by-side diffs Delta from patch set Stats (+619 lines, -82 lines) Patch
M base/BUILD.gn View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 2 chunks +9 lines, -1 line 0 comments Download
M base/debug/thread_heap_usage_tracker.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 3 chunks +14 lines, -2 lines 0 comments Download
M base/tracked_objects.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 11 chunks +94 lines, -11 lines 0 comments Download
M base/tracked_objects.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 17 chunks +143 lines, -44 lines 0 comments Download
M base/tracked_objects_unittest.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 12 chunks +138 lines, -10 lines 0 comments Download
M chrome/browser/resources/profiler/profiler.html View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 7 chunks +15 lines, -13 lines 0 comments Download
M chrome/browser/resources/profiler/profiler.js View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 7 chunks +164 lines, -1 line 0 comments Download
M chrome/browser/task_profiler/task_profiler_data_serializer.cc View 1 3 4 5 6 7 8 9 10 1 chunk +8 lines, -0 lines 0 comments Download
M chrome/browser/task_profiler/task_profiler_data_serializer_unittest.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 4 chunks +24 lines, -0 lines 0 comments Download
M chrome/browser/ui/webui/profiler_ui.cc View 1 2 3 4 5 6 7 8 9 10 11 12 2 chunks +4 lines, -0 lines 0 comments Download
M content/common/child_process_messages.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 1 chunk +6 lines, -0 lines 0 comments Download

Depends on Patchset:

Messages

Total messages: 104 (77 generated)
Sigurður Ásgeirsson
Hey guys, heads up on this CL. This is currently a WIP, and more or ...
4 years, 2 months ago (2016-10-06 17:51:45 UTC) #7
Primiano Tucci (use gerrit)
not too fmailiar with the metric/profiler but overall this makes sense, with some comments here ...
4 years, 2 months ago (2016-10-13 20:47:45 UTC) #8
fdoray
https://codereview.chromium.org/2386123003/diff/80001/base/debug/scoped_thread_heap_usage.cc File base/debug/scoped_thread_heap_usage.cc (right): https://codereview.chromium.org/2386123003/diff/80001/base/debug/scoped_thread_heap_usage.cc#newcode268 base/debug/scoped_thread_heap_usage.cc:268: g_thread_allocator_usage.Initialize([](void* allocator_usage) { How can you be sure that ...
4 years, 2 months ago (2016-10-14 13:03:32 UTC) #10
Sigurður Ásgeirsson
https://codereview.chromium.org/2386123003/diff/80001/base/debug/scoped_thread_heap_usage.cc File base/debug/scoped_thread_heap_usage.cc (right): https://codereview.chromium.org/2386123003/diff/80001/base/debug/scoped_thread_heap_usage.cc#newcode8 base/debug/scoped_thread_heap_usage.cc:8: On 2016/10/13 20:47:44, Primiano Tucci wrote: > if defined(OS_WINDOWS) ...
4 years, 2 months ago (2016-10-14 13:23:48 UTC) #11
Sigurður Ásgeirsson
Thanks. I addressed this set of comments, but now I'm going to break out the ...
4 years, 2 months ago (2016-10-14 20:11:36 UTC) #12
Sigurður Ásgeirsson
Hey guys, I think this is ready for another round of review. Siggi
4 years, 1 month ago (2016-11-15 19:54:09 UTC) #20
Primiano Tucci (use gerrit)
Generally the code looks good with some minor comments on my side. My major question ...
4 years, 1 month ago (2016-11-16 16:39:10 UTC) #33
Sigurður Ásgeirsson
On Wed, Nov 16, 2016 at 11:39 AM <primiano@chromium.org> wrote: > Generally the code looks ...
4 years, 1 month ago (2016-11-16 17:56:29 UTC) #34
Sigurður Ásgeirsson
Addressed comments and fixed a gnarly bug on thread that thankfully triggered CHECKs. https://codereview.chromium.org/2386123003/diff/300001/base/tracked_objects.cc File ...
4 years, 1 month ago (2016-11-16 21:30:28 UTC) #36
Sigurður Ásgeirsson
Looks like this is ready for another review - I've squashed all the test failures ...
4 years, 1 month ago (2016-11-18 16:13:30 UTC) #44
Primiano Tucci (use gerrit)
I am terribly sorry for the delay on this. Allright, non-owner LGTM with some final ...
4 years ago (2016-11-28 18:38:31 UTC) #55
Sigurður Ásgeirsson
Thanks. I'm afraid the build flag has to stay, as I want to be able ...
4 years ago (2016-11-30 14:41:14 UTC) #62
Sigurður Ásgeirsson
Nico and Daniel, can I ask you for owners approval, please? As per the CL ...
4 years ago (2016-11-30 15:36:42 UTC) #64
Primiano Tucci (use gerrit)
fwiw still lgtm. good luck with all the rest ;-) https://codereview.chromium.org/2386123003/diff/300001/base/tracked_objects.cc File base/tracked_objects.cc (right): https://codereview.chromium.org/2386123003/diff/300001/base/tracked_objects.cc#newcode80 ...
4 years ago (2016-11-30 16:22:09 UTC) #67
dcheng
https://codereview.chromium.org/2386123003/diff/560001/base/tracked_objects.cc File base/tracked_objects.cc (right): https://codereview.chromium.org/2386123003/diff/560001/base/tracked_objects.cc#newcode84 base/tracked_objects.cc:84: base::CheckedNumeric<int32_t> new_sum = *sum; How come it's safe to ...
4 years ago (2016-12-01 07:44:28 UTC) #68
dcheng
https://codereview.chromium.org/2386123003/diff/560001/base/tracked_objects.cc File base/tracked_objects.cc (right): https://codereview.chromium.org/2386123003/diff/560001/base/tracked_objects.cc#newcode84 base/tracked_objects.cc:84: base::CheckedNumeric<int32_t> new_sum = *sum; On 2016/12/01 07:44:28, dcheng wrote: ...
4 years ago (2016-12-01 07:48:26 UTC) #69
Sigurður Ásgeirsson
Thanks - another look? https://codereview.chromium.org/2386123003/diff/560001/base/tracked_objects.cc File base/tracked_objects.cc (right): https://codereview.chromium.org/2386123003/diff/560001/base/tracked_objects.cc#newcode84 base/tracked_objects.cc:84: base::CheckedNumeric<int32_t> new_sum = *sum; On ...
4 years ago (2016-12-01 14:01:11 UTC) #72
Nico
lgtm, but +eroman for chrome/browser/resources/profiler/OWNERS (looks right to me, but I'm not very familiar with ...
4 years ago (2016-12-02 01:45:13 UTC) #86
dcheng
there's a lot of handwaving around the atomics here from my perspective, but it seems ...
4 years ago (2016-12-02 08:05:35 UTC) #87
Sigurður Ásgeirsson
Thanks Nico and Daniel. Eric for the chrome/browser/resources/profiler HTMLish stuff OWNERs review please? https://codereview.chromium.org/2386123003/diff/640001/base/tracked_objects.cc File ...
4 years ago (2016-12-02 15:34:28 UTC) #88
Nico
https://codereview.chromium.org/2386123003/diff/640001/base/tracked_objects.cc File base/tracked_objects.cc (right): https://codereview.chromium.org/2386123003/diff/640001/base/tracked_objects.cc#newcode181 base/tracked_objects.cc:181: // give the compiler the maximal opportunity to inline ...
4 years ago (2016-12-02 15:35:57 UTC) #89
Sigurður Ásgeirsson
https://codereview.chromium.org/2386123003/diff/640001/base/tracked_objects.cc File base/tracked_objects.cc (right): https://codereview.chromium.org/2386123003/diff/640001/base/tracked_objects.cc#newcode181 base/tracked_objects.cc:181: // give the compiler the maximal opportunity to inline ...
4 years ago (2016-12-02 16:45:11 UTC) #92
eroman
LGTM chrome/browser/resources/profiler/* https://codereview.chromium.org/2386123003/diff/660001/chrome/browser/resources/profiler/profiler.js File chrome/browser/resources/profiler/profiler.js (right): https://codereview.chromium.org/2386123003/diff/660001/chrome/browser/resources/profiler/profiler.js#newcode131 chrome/browser/resources/profiler/profiler.js:131: var KEY_AVG_ALLOC_OPS = END_KEY++; I suggest giving ...
4 years ago (2016-12-02 17:13:37 UTC) #93
Sigurður Ásgeirsson
Thanks, I'm going to try and land this. https://codereview.chromium.org/2386123003/diff/660001/chrome/browser/resources/profiler/profiler.js File chrome/browser/resources/profiler/profiler.js (right): https://codereview.chromium.org/2386123003/diff/660001/chrome/browser/resources/profiler/profiler.js#newcode131 chrome/browser/resources/profiler/profiler.js:131: var ...
4 years ago (2016-12-02 18:58:09 UTC) #98
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/2386123003/680001
4 years ago (2016-12-02 18:58:16 UTC) #99
commit-bot: I haz the power
Committed patchset #33 (id:680001)
4 years ago (2016-12-02 20:04:57 UTC) #102
commit-bot: I haz the power
4 years ago (2016-12-02 20:07:01 UTC) #104
Message was sent while issue was closed.
Patchset 33 (id:??) landed as
https://crrev.com/de38d0cc1f554562dc9062c97079585cc6522fe7
Cr-Commit-Position: refs/heads/master@{#436003}

Powered by Google App Engine
This is Rietveld 408576698