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" |
11 #include "base/logging.h" | 11 #include "base/logging.h" |
12 #include "base/strings/stringprintf.h" | 12 #include "base/strings/stringprintf.h" |
13 #include "base/synchronization/waitable_event.h" | 13 #include "base/synchronization/waitable_event.h" |
14 | 14 |
15 namespace { | 15 namespace { |
16 | 16 |
17 int g_atrace_fd = -1; | 17 int g_atrace_fd = -1; |
18 const char* kATraceMarkerFile = "/sys/kernel/debug/tracing/trace_marker"; | 18 const char kATraceMarkerFile[] = "/sys/kernel/debug/tracing/trace_marker"; |
19 | 19 |
20 void WriteEvent( | 20 void WriteEvent( |
21 char phase, | 21 char phase, |
22 const char* category_group, | 22 const char* category_group, |
23 const char* name, | 23 const char* name, |
24 unsigned long long id, | 24 unsigned long long id, |
25 const char** arg_names, | 25 const char** arg_names, |
26 const unsigned char* arg_types, | 26 const unsigned char* arg_types, |
27 const base::debug::TraceEvent::TraceValue* arg_values, | 27 const base::debug::TraceEvent::TraceValue* arg_values, |
28 const scoped_refptr<base::debug::ConvertableToTraceFormat>* | 28 const scoped_refptr<base::debug::ConvertableToTraceFormat>* |
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
190 double now_in_seconds = now.ToInternalValue() / 1000000.0; | 190 double now_in_seconds = now.ToInternalValue() / 1000000.0; |
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 debug | 198 } // namespace debug |
199 } // namespace base | 199 } // namespace base |
OLD | NEW |