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

Side by Side Diff: base/trace_event/trace_event_android.cc

Issue 1165673002: [Startup Tracing] Hook up TraceConfig and remove CategoryFilter & TraceOptions (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "base/trace_event/trace_event_impl.h" 5 #include "base/trace_event/trace_event_impl.h"
6 6
7 #include <fcntl.h> 7 #include <fcntl.h>
8 8
9 #include "base/format_macros.h" 9 #include "base/format_macros.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
90 90
91 void TraceLog::StartATrace() { 91 void TraceLog::StartATrace() {
92 if (g_atrace_fd != -1) 92 if (g_atrace_fd != -1)
93 return; 93 return;
94 94
95 g_atrace_fd = open(kATraceMarkerFile, O_WRONLY); 95 g_atrace_fd = open(kATraceMarkerFile, O_WRONLY);
96 if (g_atrace_fd == -1) { 96 if (g_atrace_fd == -1) {
97 PLOG(WARNING) << "Couldn't open " << kATraceMarkerFile; 97 PLOG(WARNING) << "Couldn't open " << kATraceMarkerFile;
98 return; 98 return;
99 } 99 }
100 SetEnabled(CategoryFilter(CategoryFilter::kDefaultCategoryFilterString), 100 TraceConfig trace_config;
dsinclair 2015/06/02 13:56:55 Should we set kDefaultCategoryFilterString here ju
Zhen Wang 2015/06/02 16:24:42 We do not use kDefaultCategoryFilterString any mor
101 TraceLog::RECORDING_MODE, 101 trace_config.SetTraceRecordMode(RECORD_CONTINUOUSLY);
102 TraceOptions(RECORD_CONTINUOUSLY)); 102 SetEnabled(trace_config, TraceLog::RECORDING_MODE);
103 } 103 }
104 104
105 void TraceLog::StopATrace() { 105 void TraceLog::StopATrace() {
106 if (g_atrace_fd == -1) 106 if (g_atrace_fd == -1)
107 return; 107 return;
108 108
109 close(g_atrace_fd); 109 close(g_atrace_fd);
110 g_atrace_fd = -1; 110 g_atrace_fd = -1;
111 111
112 // TraceLog::Flush() requires the current thread to have a message loop, but 112 // TraceLog::Flush() requires the current thread to have a message loop, but
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
190 double now_in_seconds = (TraceTicks::Now() - TraceTicks()).InSecondsF(); 190 double now_in_seconds = (TraceTicks::Now() - TraceTicks()).InSecondsF();
191 std::string marker = StringPrintf( 191 std::string marker = StringPrintf(
192 "trace_event_clock_sync: parent_ts=%f\n", now_in_seconds); 192 "trace_event_clock_sync: parent_ts=%f\n", now_in_seconds);
193 if (write(atrace_fd, marker.c_str(), marker.size()) == -1) 193 if (write(atrace_fd, marker.c_str(), marker.size()) == -1)
194 PLOG(WARNING) << "Couldn't write to " << kATraceMarkerFile; 194 PLOG(WARNING) << "Couldn't write to " << kATraceMarkerFile;
195 close(atrace_fd); 195 close(atrace_fd);
196 } 196 }
197 197
198 } // namespace trace_event 198 } // namespace trace_event
199 } // namespace base 199 } // namespace base
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698