| 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 <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include "base/format_macros.h" | 9 #include "base/format_macros.h" |
| 10 #include "base/json/string_escape.h" | 10 #include "base/json/string_escape.h" |
| (...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 178 // Only reset fields that won't be initialized in Initialize(), or that may | 178 // Only reset fields that won't be initialized in Initialize(), or that may |
| 179 // hold references to other objects. | 179 // hold references to other objects. |
| 180 duration_ = TimeDelta::FromInternalValue(-1); | 180 duration_ = TimeDelta::FromInternalValue(-1); |
| 181 parameter_copy_storage_.reset(); | 181 parameter_copy_storage_.reset(); |
| 182 for (int i = 0; i < kTraceMaxNumArgs; ++i) | 182 for (int i = 0; i < kTraceMaxNumArgs; ++i) |
| 183 convertable_values_[i].reset(); | 183 convertable_values_[i].reset(); |
| 184 } | 184 } |
| 185 | 185 |
| 186 void TraceEvent::UpdateDuration(const TimeTicks& now, | 186 void TraceEvent::UpdateDuration(const TimeTicks& now, |
| 187 const ThreadTicks& thread_now) { | 187 const ThreadTicks& thread_now) { |
| 188 DCHECK_EQ(duration_.ToInternalValue(), -1); | 188 if (duration_.ToInternalValue() != -1) { |
| 189 LOG(ERROR) << "ssid duration is already set " << flags_ << " " << timestamp_
<< " " << name_ << " " << (parameter_copy_storage_.get() ? *parameter_copy_stor
age_.get() : "no param") << " " << TraceLog::GetCategoryGroupName(category_group
_enabled_); |
| 190 } |
| 191 CHECK_EQ(duration_.ToInternalValue(), -1); |
| 189 duration_ = now - timestamp_; | 192 duration_ = now - timestamp_; |
| 190 | 193 |
| 191 // |thread_timestamp_| can be empty if the thread ticks clock wasn't | 194 // |thread_timestamp_| can be empty if the thread ticks clock wasn't |
| 192 // initialized when it was recorded. | 195 // initialized when it was recorded. |
| 193 if (thread_timestamp_ != ThreadTicks()) | 196 if (thread_timestamp_ != ThreadTicks()) |
| 194 thread_duration_ = thread_now - thread_timestamp_; | 197 thread_duration_ = thread_now - thread_timestamp_; |
| 195 } | 198 } |
| 196 | 199 |
| 197 void TraceEvent::EstimateTraceMemoryOverhead( | 200 void TraceEvent::EstimateTraceMemoryOverhead( |
| 198 TraceEventMemoryOverhead* overhead) { | 201 TraceEventMemoryOverhead* overhead) { |
| (...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 417 AppendValueAsJSON(arg_types_[i], arg_values_[i], &value_as_text); | 420 AppendValueAsJSON(arg_types_[i], arg_values_[i], &value_as_text); |
| 418 | 421 |
| 419 *out << value_as_text; | 422 *out << value_as_text; |
| 420 } | 423 } |
| 421 *out << "}"; | 424 *out << "}"; |
| 422 } | 425 } |
| 423 } | 426 } |
| 424 | 427 |
| 425 } // namespace trace_event | 428 } // namespace trace_event |
| 426 } // namespace base | 429 } // namespace base |
| OLD | NEW |