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

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

Issue 1122153002: Fixit: Fork base::TimeTicks --> TimeTicks + ThreadTicks + TraceTicks (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@FIXIT_timeclasses_1of2
Patch Set: REBASE after it passed CQ but did not commit to tree 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
« no previous file with comments | « base/trace_event/trace_event.h ('k') | base/trace_event/trace_event_impl.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 169 matching lines...) Expand 10 before | Expand all | Expand 10 after
180 int atrace_fd = open(kATraceMarkerFile, O_WRONLY | O_APPEND); 180 int atrace_fd = open(kATraceMarkerFile, O_WRONLY | O_APPEND);
181 if (atrace_fd == -1) { 181 if (atrace_fd == -1) {
182 PLOG(WARNING) << "Couldn't open " << kATraceMarkerFile; 182 PLOG(WARNING) << "Couldn't open " << kATraceMarkerFile;
183 return; 183 return;
184 } 184 }
185 185
186 // Android's kernel trace system has a trace_marker feature: this is a file on 186 // Android's kernel trace system has a trace_marker feature: this is a file on
187 // debugfs that takes the written data and pushes it onto the trace 187 // debugfs that takes the written data and pushes it onto the trace
188 // buffer. So, to establish clock sync, we write our monotonic clock into that 188 // buffer. So, to establish clock sync, we write our monotonic clock into that
189 // trace buffer. 189 // trace buffer.
190 TimeTicks now = TimeTicks::NowFromSystemTraceTime(); 190 double now_in_seconds = (TraceTicks::Now() - TraceTicks()).InSecondsF();
191 double now_in_seconds = now.ToInternalValue() / 1000000.0;
192 std::string marker = StringPrintf( 191 std::string marker = StringPrintf(
193 "trace_event_clock_sync: parent_ts=%f\n", now_in_seconds); 192 "trace_event_clock_sync: parent_ts=%f\n", now_in_seconds);
194 if (write(atrace_fd, marker.c_str(), marker.size()) == -1) 193 if (write(atrace_fd, marker.c_str(), marker.size()) == -1)
195 PLOG(WARNING) << "Couldn't write to " << kATraceMarkerFile; 194 PLOG(WARNING) << "Couldn't write to " << kATraceMarkerFile;
196 close(atrace_fd); 195 close(atrace_fd);
197 } 196 }
198 197
199 } // namespace trace_event 198 } // namespace trace_event
200 } // namespace base 199 } // namespace base
OLDNEW
« no previous file with comments | « base/trace_event/trace_event.h ('k') | base/trace_event/trace_event_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698