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 "base/format_macros.h" | 7 #include "base/format_macros.h" |
8 #include "base/json/string_escape.h" | 8 #include "base/json/string_escape.h" |
9 #include "base/stl_util.h" | 9 #include "base/stl_util.h" |
10 #include "base/strings/string_number_conversions.h" | 10 #include "base/strings/string_number_conversions.h" |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
68 for (int i = 0; i < kTraceMaxNumArgs; ++i) { | 68 for (int i = 0; i < kTraceMaxNumArgs; ++i) { |
69 arg_names_[i] = other.arg_names_[i]; | 69 arg_names_[i] = other.arg_names_[i]; |
70 arg_types_[i] = other.arg_types_[i]; | 70 arg_types_[i] = other.arg_types_[i]; |
71 arg_values_[i] = other.arg_values_[i]; | 71 arg_values_[i] = other.arg_values_[i]; |
72 convertable_values_[i] = other.convertable_values_[i]; | 72 convertable_values_[i] = other.convertable_values_[i]; |
73 } | 73 } |
74 } | 74 } |
75 | 75 |
76 void TraceEvent::Initialize( | 76 void TraceEvent::Initialize( |
77 int thread_id, | 77 int thread_id, |
78 TraceTicks timestamp, | 78 TimeTicks timestamp, |
79 ThreadTicks thread_timestamp, | 79 ThreadTicks thread_timestamp, |
80 char phase, | 80 char phase, |
81 const unsigned char* category_group_enabled, | 81 const unsigned char* category_group_enabled, |
82 const char* name, | 82 const char* name, |
83 unsigned long long id, | 83 unsigned long long id, |
84 unsigned long long context_id, | 84 unsigned long long context_id, |
85 unsigned long long bind_id, | 85 unsigned long long bind_id, |
86 int num_args, | 86 int num_args, |
87 const char** arg_names, | 87 const char** arg_names, |
88 const unsigned char* arg_types, | 88 const unsigned char* arg_types, |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
166 | 166 |
167 void TraceEvent::Reset() { | 167 void TraceEvent::Reset() { |
168 // Only reset fields that won't be initialized in Initialize(), or that may | 168 // Only reset fields that won't be initialized in Initialize(), or that may |
169 // hold references to other objects. | 169 // hold references to other objects. |
170 duration_ = TimeDelta::FromInternalValue(-1); | 170 duration_ = TimeDelta::FromInternalValue(-1); |
171 parameter_copy_storage_ = NULL; | 171 parameter_copy_storage_ = NULL; |
172 for (int i = 0; i < kTraceMaxNumArgs; ++i) | 172 for (int i = 0; i < kTraceMaxNumArgs; ++i) |
173 convertable_values_[i] = NULL; | 173 convertable_values_[i] = NULL; |
174 } | 174 } |
175 | 175 |
176 void TraceEvent::UpdateDuration(const TraceTicks& now, | 176 void TraceEvent::UpdateDuration(const TimeTicks& now, |
177 const ThreadTicks& thread_now) { | 177 const ThreadTicks& thread_now) { |
178 DCHECK_EQ(duration_.ToInternalValue(), -1); | 178 DCHECK_EQ(duration_.ToInternalValue(), -1); |
179 duration_ = now - timestamp_; | 179 duration_ = now - timestamp_; |
180 | 180 |
181 // |thread_timestamp_| can be empty if the thread ticks clock wasn't | 181 // |thread_timestamp_| can be empty if the thread ticks clock wasn't |
182 // initialized when it was recorded. | 182 // initialized when it was recorded. |
183 if (thread_timestamp_ != ThreadTicks()) | 183 if (thread_timestamp_ != ThreadTicks()) |
184 thread_duration_ = thread_now - thread_timestamp_; | 184 thread_duration_ = thread_now - thread_timestamp_; |
185 } | 185 } |
186 | 186 |
(...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
403 AppendValueAsJSON(arg_types_[i], arg_values_[i], &value_as_text); | 403 AppendValueAsJSON(arg_types_[i], arg_values_[i], &value_as_text); |
404 | 404 |
405 *out << value_as_text; | 405 *out << value_as_text; |
406 } | 406 } |
407 *out << "}"; | 407 *out << "}"; |
408 } | 408 } |
409 } | 409 } |
410 | 410 |
411 } // namespace trace_event | 411 } // namespace trace_event |
412 } // namespace base | 412 } // namespace base |
OLD | NEW |