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

Issue 22962004: Thread-local trace-event buffers (Closed)

Created:
7 years, 4 months ago by Xianzhu
Modified:
7 years, 3 months ago
Reviewers:
dsinclair, nduca
CC:
chromium-reviews, dsinclair+watch_chromium.org, erikwright+watch_chromium.org
Base URL:
https://chromium.googlesource.com/chromium/src.git@master
Visibility:
Public.

Description

Thread-local trace-event buffers Previously we use a central trace-event buffer to store trace events from all threads, which needs a lock. Measurement showed that on Android the lock contributes over 50% of the total overhead of trace event. Use thread-local trace-event buffers so that in most times trace events can be handled lock-free. TraceLog::Flush() now may asynchronously call the callback. TODO: Now for a message loop running a blocking task, async flush doesn't work. The async flush will timeout and finish without collecting the last batch of such thread if any. On Nexus 4 this patch can reduce the average overhead of trace_event from 15~20us to about 5~8us for a busy app. Note the numbers are not very accurate because - the time tick seems 30us on Android. The average number may be just a result of increased percentage of trace events whose overhead < 30us. - there are differences in the measurement method of the overhead because of the change of the code structure. BUG=264667 TEST=Updated existing tests: TraceEventTestFixture.DataCapturedOnThread and TraceEventTestFixture.DataCapturedManyThreads. Existing unit/browser tests using trace_event should still pass. R=nduca, dsinclair TBR=phajdan.jr (for base/test/trace_event_analyzer_unittest.cc) Committed: https://src.chromium.org/viewvc/chrome?view=rev&revision=221766

Patch Set 1 : #

Total comments: 8

Patch Set 2 : #

Total comments: 18

Patch Set 3 : #

Total comments: 9

Patch Set 4 : THREAD_LOCAL_BUFFERS as an option; Tests still missing #

Patch Set 5 : #

Patch Set 6 : #

Total comments: 24

Patch Set 7 : #

Patch Set 8 : Thread flush timeout; Shrink thread-local buffer size #

Patch Set 9 : Update browser_shutdown_profile_dumper #

Unified diffs Side-by-side diffs Delta from patch set Stats (+544 lines, -117 lines) Patch
M base/debug/trace_event_impl.h View 1 2 3 4 5 6 7 12 chunks +58 lines, -12 lines 0 comments Download
M base/debug/trace_event_impl.cc View 1 2 3 4 5 6 7 8 21 chunks +377 lines, -57 lines 0 comments Download
M base/debug/trace_event_unittest.cc View 1 2 3 4 5 5 chunks +34 lines, -6 lines 0 comments Download
M base/test/trace_event_analyzer_unittest.cc View 1 2 3 4 4 chunks +13 lines, -3 lines 0 comments Download
M components/tracing/child_trace_message_filter.h View 1 2 3 4 1 chunk +2 lines, -1 line 0 comments Download
M components/tracing/child_trace_message_filter.cc View 1 2 3 4 5 2 chunks +15 lines, -11 lines 0 comments Download
M content/browser/browser_shutdown_profile_dumper.h View 1 2 3 4 5 6 7 8 1 chunk +2 lines, -1 line 0 comments Download
M content/browser/browser_shutdown_profile_dumper.cc View 1 2 3 4 5 6 7 8 3 chunks +8 lines, -5 lines 0 comments Download
M content/browser/tracing/trace_controller_impl.h View 1 2 3 4 5 1 chunk +5 lines, -0 lines 0 comments Download
M content/browser/tracing/trace_controller_impl.cc View 1 2 3 4 5 6 4 chunks +29 lines, -21 lines 0 comments Download
M content/browser/tracing/trace_subscriber_stdio.cc View 1 2 3 4 5 1 chunk +1 line, -0 lines 0 comments Download

Messages

Total messages: 30 (0 generated)
Xianzhu
Uploaded the patch set for pre-review. Adding unit tests.
7 years, 4 months ago (2013-08-13 19:42:01 UTC) #1
dsinclair
Added a few comments. My concern with this is that, at least for me, this ...
7 years, 4 months ago (2013-08-13 21:04:41 UTC) #2
Xianzhu
Thanks for review. Uploaded Patch Set 2. Still for preview until we address all potential ...
7 years, 4 months ago (2013-08-13 23:35:50 UTC) #3
dsinclair
Thanks a lot for the doc, clarified some things for me. Added a few comments ...
7 years, 4 months ago (2013-08-14 15:15:59 UTC) #4
nduca
I left a few comments on the doc. first off, ___thank you so much for ...
7 years, 4 months ago (2013-08-14 18:37:11 UTC) #5
nduca
Also, I think we might want to seriously pursue the X event. Its an easier ...
7 years, 4 months ago (2013-08-14 18:37:51 UTC) #6
Xianzhu
On 2013/08/14 18:37:11, nduca wrote: > I left a few comments on the doc. first ...
7 years, 4 months ago (2013-08-14 20:21:04 UTC) #7
Xianzhu
*** Patch Set 3 is still for preview. The document is open for discussion. *** ...
7 years, 4 months ago (2013-08-14 21:28:33 UTC) #8
dsinclair
A few more comments but I think it is a lot better in terms of ...
7 years, 4 months ago (2013-08-16 14:38:32 UTC) #9
Xianzhu
- Updated the document, added comments about fully-local thread buffers. - Made THREAD_LOCAL_BUFFERS an option ...
7 years, 4 months ago (2013-08-16 19:41:03 UTC) #10
nduca
I'd suggest enabling this everywhere, or nowhere. Not android specific. Tracing gets a lot of ...
7 years, 4 months ago (2013-08-17 02:26:19 UTC) #11
Xianzhu
On 2013/08/17 02:26:19, nduca wrote: > I'd suggest enabling this everywhere, or nowhere. Not android ...
7 years, 3 months ago (2013-08-27 18:21:43 UTC) #12
Xianzhu
On 2013/08/27 18:21:43, Xianzhu wrote: > PTAL. Changes in the last Patch Set: > - ...
7 years, 3 months ago (2013-08-27 18:41:15 UTC) #13
Xianzhu
The last patch set is now ready for review. Thanks for your patience.
7 years, 3 months ago (2013-08-28 21:37:52 UTC) #14
dsinclair
This is looking really good. The code is a lot easier to follow and the ...
7 years, 3 months ago (2013-08-29 14:24:32 UTC) #15
Xianzhu
https://codereview.chromium.org/22962004/diff/40001/base/debug/trace_event_impl.cc File base/debug/trace_event_impl.cc (right): https://codereview.chromium.org/22962004/diff/40001/base/debug/trace_event_impl.cc#newcode77 base/debug/trace_event_impl.cc:77: // For reporting trace_event overhead. For thread local event ...
7 years, 3 months ago (2013-08-29 17:42:12 UTC) #16
dsinclair
lgtm, this is good to me once nduca is happy.
7 years, 3 months ago (2013-08-29 17:49:02 UTC) #17
nduca
lgtm. Xianzhu, you constantly amaze me.
7 years, 3 months ago (2013-08-30 01:05:34 UTC) #18
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/wangxianzhu@chromium.org/22962004/53001
7 years, 3 months ago (2013-08-30 16:36:25 UTC) #19
commit-bot: I haz the power
Retried try job too often on chromium_presubmit for step(s) presubmit http://build.chromium.org/p/tryserver.chromium/buildstatus?builder=chromium_presubmit&number=23236
7 years, 3 months ago (2013-08-30 16:47:27 UTC) #20
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/wangxianzhu@chromium.org/22962004/53001
7 years, 3 months ago (2013-08-30 17:34:39 UTC) #21
Xianzhu
Found a fundamental issue of the CL (based on the failures on the try bots ...
7 years, 3 months ago (2013-09-03 20:45:55 UTC) #22
dsinclair
On 2013/09/03 20:45:55, Xianzhu wrote: > Found a fundamental issue of the CL (based on ...
7 years, 3 months ago (2013-09-03 21:06:43 UTC) #23
Xianzhu
On 2013/09/03 21:06:43, dsinclair wrote: > On 2013/09/03 20:45:55, Xianzhu wrote: > > Found a ...
7 years, 3 months ago (2013-09-03 21:40:04 UTC) #24
Xianzhu
On 2013/09/03 21:40:04, Xianzhu wrote: > On 2013/09/03 21:06:43, dsinclair wrote: > > On 2013/09/03 ...
7 years, 3 months ago (2013-09-03 22:02:45 UTC) #25
Xianzhu
PTAL. In the latest patch: - added timeout when waiting for thread-local flush; - changed ...
7 years, 3 months ago (2013-09-03 23:34:20 UTC) #26
dsinclair
lgtm
7 years, 3 months ago (2013-09-04 14:24:27 UTC) #27
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/wangxianzhu@chromium.org/22962004/68001
7 years, 3 months ago (2013-09-04 19:08:46 UTC) #28
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/wangxianzhu@chromium.org/22962004/114001
7 years, 3 months ago (2013-09-06 16:51:27 UTC) #29
commit-bot: I haz the power
7 years, 3 months ago (2013-09-06 20:18:12 UTC) #30
Message was sent while issue was closed.
Change committed as 221766

Powered by Google App Engine
This is Rietveld 408576698