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 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
79 AutoLock lock(lock_); | 79 AutoLock lock(lock_); |
80 if (g_atrace_fd != -1) { | 80 if (g_atrace_fd != -1) { |
81 close(g_atrace_fd); | 81 close(g_atrace_fd); |
82 g_atrace_fd = -1; | 82 g_atrace_fd = -1; |
83 UpdateCategoryGroupEnabledFlags(); | 83 UpdateCategoryGroupEnabledFlags(); |
84 } | 84 } |
85 } | 85 } |
86 | 86 |
87 void TraceLog::SendToATrace( | 87 void TraceLog::SendToATrace( |
88 char phase, | 88 char phase, |
89 const char* category_group, | 89 const unsigned char* category_group_enabled, |
90 const char* name, | 90 const char* name, |
91 unsigned long long id, | 91 unsigned long long id, |
92 int num_args, | 92 int num_args, |
93 const char** arg_names, | 93 const char** arg_names, |
94 const unsigned char* arg_types, | 94 const unsigned char* arg_types, |
95 const unsigned long long* arg_values, | 95 const unsigned long long* arg_values, |
96 scoped_ptr<ConvertableToTraceFormat> convertable_values[], | 96 scoped_ptr<ConvertableToTraceFormat> convertable_values[], |
97 unsigned char flags) { | 97 unsigned char flags) { |
98 if (g_atrace_fd == -1) | 98 if (g_atrace_fd == -1) |
99 return; | 99 return; |
100 | 100 |
101 const char* category_group = GetCategoryGroupName(category_group_enabled); | |
dsinclair
2013/08/13 21:04:42
This seems unrelated, move to its own CL?
Xianzhu
2013/08/14 21:28:33
Done.
| |
101 switch (phase) { | 102 switch (phase) { |
102 case TRACE_EVENT_PHASE_BEGIN: | 103 case TRACE_EVENT_PHASE_BEGIN: |
103 WriteEvent('B', category_group, name, id, | 104 WriteEvent('B', category_group, name, id, |
104 num_args, arg_names, arg_types, arg_values, convertable_values, | 105 num_args, arg_names, arg_types, arg_values, convertable_values, |
105 flags); | 106 flags); |
106 break; | 107 break; |
107 | 108 |
108 case TRACE_EVENT_PHASE_END: | 109 case TRACE_EVENT_PHASE_END: |
109 // Though a single 'E' is enough, here append pid, name and | 110 // Though a single 'E' is enough, here append pid, name and |
110 // category_group etc. So that unpaired events can be found easily. | 111 // category_group etc. So that unpaired events can be found easily. |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
149 const char* category_group = GetCategoryGroupName(category_group_enabled); | 150 const char* category_group = GetCategoryGroupName(category_group_enabled); |
150 if (strncmp(category_group, TRACE_DISABLED_BY_DEFAULT(""), | 151 if (strncmp(category_group, TRACE_DISABLED_BY_DEFAULT(""), |
151 strlen(TRACE_DISABLED_BY_DEFAULT(""))) == 0) | 152 strlen(TRACE_DISABLED_BY_DEFAULT(""))) == 0) |
152 return; | 153 return; |
153 | 154 |
154 *category_group_enabled |= ATRACE_ENABLED; | 155 *category_group_enabled |= ATRACE_ENABLED; |
155 } | 156 } |
156 | 157 |
157 } // namespace debug | 158 } // namespace debug |
158 } // namespace base | 159 } // namespace base |
OLD | NEW |