| OLD | NEW |
| 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 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 194 int atrace_fd = HANDLE_EINTR(open(kATraceMarkerFile, O_WRONLY | O_APPEND)); | 194 int atrace_fd = HANDLE_EINTR(open(kATraceMarkerFile, O_WRONLY | O_APPEND)); |
| 195 if (atrace_fd == -1) { | 195 if (atrace_fd == -1) { |
| 196 PLOG(WARNING) << "Couldn't open " << kATraceMarkerFile; | 196 PLOG(WARNING) << "Couldn't open " << kATraceMarkerFile; |
| 197 return; | 197 return; |
| 198 } | 198 } |
| 199 | 199 |
| 200 // Android's kernel trace system has a trace_marker feature: this is a file on | 200 // Android's kernel trace system has a trace_marker feature: this is a file on |
| 201 // debugfs that takes the written data and pushes it onto the trace | 201 // debugfs that takes the written data and pushes it onto the trace |
| 202 // buffer. So, to establish clock sync, we write our monotonic clock into that | 202 // buffer. So, to establish clock sync, we write our monotonic clock into that |
| 203 // trace buffer. | 203 // trace buffer. |
| 204 double now_in_seconds = (TraceTicks::Now() - TraceTicks()).InSecondsF(); | 204 double now_in_seconds = (TimeTicks::Now() - TimeTicks()).InSecondsF(); |
| 205 std::string marker = StringPrintf( | 205 std::string marker = StringPrintf( |
| 206 "trace_event_clock_sync: parent_ts=%f\n", now_in_seconds); | 206 "trace_event_clock_sync: parent_ts=%f\n", now_in_seconds); |
| 207 WriteToATrace(atrace_fd, marker.c_str(), marker.size()); | 207 WriteToATrace(atrace_fd, marker.c_str(), marker.size()); |
| 208 close(atrace_fd); | 208 close(atrace_fd); |
| 209 } | 209 } |
| 210 | 210 |
| 211 } // namespace trace_event | 211 } // namespace trace_event |
| 212 } // namespace base | 212 } // namespace base |
| OLD | NEW |