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/debug/trace_event_impl.h" | 5 #include "base/debug/trace_event_impl.h" |
6 | 6 |
7 #include <fcntl.h> | 7 #include <fcntl.h> |
8 | 8 |
9 #include "base/debug/trace_event.h" | 9 #include "base/debug/trace_event.h" |
10 #include "base/format_macros.h" | 10 #include "base/format_macros.h" |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
90 void TraceLog::StartATrace() { | 90 void TraceLog::StartATrace() { |
91 if (g_atrace_fd != -1) | 91 if (g_atrace_fd != -1) |
92 return; | 92 return; |
93 | 93 |
94 g_atrace_fd = open(kATraceMarkerFile, O_WRONLY); | 94 g_atrace_fd = open(kATraceMarkerFile, O_WRONLY); |
95 if (g_atrace_fd == -1) { | 95 if (g_atrace_fd == -1) { |
96 PLOG(WARNING) << "Couldn't open " << kATraceMarkerFile; | 96 PLOG(WARNING) << "Couldn't open " << kATraceMarkerFile; |
97 return; | 97 return; |
98 } | 98 } |
99 SetEnabled(CategoryFilter(CategoryFilter::kDefaultCategoryFilterString), | 99 SetEnabled(CategoryFilter(CategoryFilter::kDefaultCategoryFilterString), |
| 100 base::debug::TraceLog::RECORDING_MODE, |
100 RECORD_CONTINUOUSLY); | 101 RECORD_CONTINUOUSLY); |
101 } | 102 } |
102 | 103 |
103 void TraceLog::StopATrace() { | 104 void TraceLog::StopATrace() { |
104 if (g_atrace_fd == -1) | 105 if (g_atrace_fd == -1) |
105 return; | 106 return; |
106 | 107 |
107 close(g_atrace_fd); | 108 close(g_atrace_fd); |
108 g_atrace_fd = -1; | 109 g_atrace_fd = -1; |
109 | 110 |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
189 double now_in_seconds = now.ToInternalValue() / 1000000.0; | 190 double now_in_seconds = now.ToInternalValue() / 1000000.0; |
190 std::string marker = StringPrintf( | 191 std::string marker = StringPrintf( |
191 "trace_event_clock_sync: parent_ts=%f\n", now_in_seconds); | 192 "trace_event_clock_sync: parent_ts=%f\n", now_in_seconds); |
192 if (write(atrace_fd, marker.c_str(), marker.size()) == -1) | 193 if (write(atrace_fd, marker.c_str(), marker.size()) == -1) |
193 PLOG(WARNING) << "Couldn't write to " << kATraceMarkerFile; | 194 PLOG(WARNING) << "Couldn't write to " << kATraceMarkerFile; |
194 close(atrace_fd); | 195 close(atrace_fd); |
195 } | 196 } |
196 | 197 |
197 } // namespace debug | 198 } // namespace debug |
198 } // namespace base | 199 } // namespace base |
OLD | NEW |