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

Issue 1368993002: Reland of "Add thread-local allocation context for tracing" (Closed)

Created:
5 years, 2 months ago by Ruud van Asseldonk
Modified:
5 years, 2 months ago
CC:
chromium-reviews, tracing+reviews_chromium.org, wfh+watch_chromium.org
Base URL:
https://chromium.googlesource.com/chromium/src.git@master
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

Reland of "Add thread-local allocation context for tracing" This is a reland of https://crrev.com/1340013002. Original issue's description: > This introduces a thread-local context that can be used for heap > profiling. It contains a pseudo stack where trace events are the > stack frames. There is a fast early-out in case capturing context > is disabled. > > This is a prerequisite for the heap profiler in chrome://tracing. It > will log allocations with context obtained from the system introduced > here. > > This is intended to replace the tcmalloc-specific heap profiler in > base/trace_event/trace_event_memory and its pseudo stack once the heap > profiler lands. > > BUG=524631 > > Committed: https://crrev.com/abff8221c8d35916a8d7e12845ba61bc5c48aff8 > Cr-Commit-Position: refs/heads/master@{#350799} BUG=524631 TBR=primiano@chromium.org Committed: https://crrev.com/a9576610c2d86860afd8a331197285a73b0ee7ac Cr-Commit-Position: refs/heads/master@{#350880}

Patch Set 1 #

Patch Set 2 : Do not rely on string interning #

Total comments: 2

Patch Set 3 : Address primiano comment #

Total comments: 2
Unified diffs Side-by-side diffs Delta from patch set Stats (+441 lines, -0 lines) Patch
M base/trace_event/BUILD.gn View 2 chunks +3 lines, -0 lines 0 comments Download
A base/trace_event/memory_profiler_allocation_context.h View 1 chunk +119 lines, -0 lines 0 comments Download
A base/trace_event/memory_profiler_allocation_context.cc View 1 chunk +91 lines, -0 lines 2 comments Download
A base/trace_event/memory_profiler_allocation_context_unittest.cc View 1 2 1 chunk +210 lines, -0 lines 0 comments Download
M base/trace_event/trace_event.gypi View 2 chunks +3 lines, -0 lines 0 comments Download
M base/trace_event/trace_log.cc View 3 chunks +15 lines, -0 lines 0 comments Download

Messages

Total messages: 11 (2 generated)
Ruud van Asseldonk
5 years, 2 months ago (2015-09-25 15:22:21 UTC) #1
Primiano Tucci (use gerrit)
https://codereview.chromium.org/1368993002/diff/20001/base/trace_event/memory_profiler_allocation_context_unittest.cc File base/trace_event/memory_profiler_allocation_context_unittest.cc (right): https://codereview.chromium.org/1368993002/diff/20001/base/trace_event/memory_profiler_allocation_context_unittest.cc#newcode14 base/trace_event/memory_profiler_allocation_context_unittest.cc:14: const char* kCupcake = "Cupcake"; nit: const char kCupcake[] ...
5 years, 2 months ago (2015-09-25 16:53:50 UTC) #2
Primiano Tucci (use gerrit)
Anyways LGTM once you fix the char[]
5 years, 2 months ago (2015-09-25 16:55:13 UTC) #3
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1368993002/40001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1368993002/40001
5 years, 2 months ago (2015-09-25 17:38:05 UTC) #6
commit-bot: I haz the power
Committed patchset #3 (id:40001)
5 years, 2 months ago (2015-09-25 19:16:56 UTC) #7
commit-bot: I haz the power
Patchset 3 (id:??) landed as https://crrev.com/a9576610c2d86860afd8a331197285a73b0ee7ac Cr-Commit-Position: refs/heads/master@{#350880}
5 years, 2 months ago (2015-09-25 19:17:40 UTC) #8
Dmitry Skiba
https://codereview.chromium.org/1368993002/diff/40001/base/trace_event/memory_profiler_allocation_context.cc File base/trace_event/memory_profiler_allocation_context.cc (right): https://codereview.chromium.org/1368993002/diff/40001/base/trace_event/memory_profiler_allocation_context.cc#newcode30 base/trace_event/memory_profiler_allocation_context.cc:30: if (g_tls_alloc_ctx_tracker.initialized()) { Hmm, so we are setting g_tls_alloc_ctx_tracker ...
5 years, 2 months ago (2015-09-29 19:00:16 UTC) #9
Primiano Tucci (use gerrit)
Thanks for the comment dmitry! Ruud: I think we need to fix this in the ...
5 years, 2 months ago (2015-09-30 08:26:31 UTC) #10
Ruud van Asseldonk
5 years, 2 months ago (2015-10-05 09:31:27 UTC) #11
Message was sent while issue was closed.
On 2015/09/30 at 08:26:31, primiano wrote:

>   // At this point we are in the slow path
>   // Do a barriered read, as the previous one is not enough to guarantee that
the TLS has been constructed (not on all platforms).
>   if (!subtle::Acquire_Load(&capture_enabled_))))
>     return false;

Why is that? If |capture_enabled_| is initialized to false, and it is set to
true by a fully barriered write, then you can observe a stale false from a
nobarrier read, which is harmless. You can observe a stale true when disabling
capturing but that is not a problem because at that point the TLS has been
initialized. If you ever read a true then TLS has been initialized.

Powered by Google App Engine
This is Rietveld 408576698