summaryrefslogtreecommitdiffstats
path: root/content/browser/browser_shutdown_profile_dumper.h
diff options
context:
space:
mode:
authorwangxianzhu@chromium.org <wangxianzhu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-09-06 20:18:05 +0000
committerwangxianzhu@chromium.org <wangxianzhu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-09-06 20:18:05 +0000
commit07b877310a5f4b7385968b96cb5ff2a07872f83c (patch)
treeabd7b981244e087191fb7696f7fffbf1368ccf2f /content/browser/browser_shutdown_profile_dumper.h
parent116999760179c21035039a04b7a9281831a4c077 (diff)
downloadchromium_src-07b877310a5f4b7385968b96cb5ff2a07872f83c.zip
chromium_src-07b877310a5f4b7385968b96cb5ff2a07872f83c.tar.gz
chromium_src-07b877310a5f4b7385968b96cb5ff2a07872f83c.tar.bz2
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) Review URL: https://chromiumcodereview.appspot.com/22962004 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@221766 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content/browser/browser_shutdown_profile_dumper.h')
-rw-r--r--content/browser/browser_shutdown_profile_dumper.h3
1 files changed, 2 insertions, 1 deletions
diff --git a/content/browser/browser_shutdown_profile_dumper.h b/content/browser/browser_shutdown_profile_dumper.h
index bb2c09b..efccb38 100644
--- a/content/browser/browser_shutdown_profile_dumper.h
+++ b/content/browser/browser_shutdown_profile_dumper.h
@@ -42,7 +42,8 @@ class BrowserShutdownProfileDumper {
// The callback for the |TraceLog::Flush| function. It saves all traces to
// disc.
void WriteTraceDataCollected(
- const scoped_refptr<base::RefCountedString>& events_str);
+ const scoped_refptr<base::RefCountedString>& events_str,
+ bool has_more_events);
// Returns true if the dump file is valid.
bool IsFileValid();