Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(277)

Side by Side Diff: base/trace_event/trace_event_impl.cc

Issue 2857543002: tracing: Simplify TraceEventMemoryOverhead, use an enum insted of a map (Closed)
Patch Set: Fix compiler issues + omit empty values Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 180 matching lines...) Expand 10 before | Expand all | Expand 10 after
191 duration_ = now - timestamp_; 191 duration_ = now - timestamp_;
192 192
193 // |thread_timestamp_| can be empty if the thread ticks clock wasn't 193 // |thread_timestamp_| can be empty if the thread ticks clock wasn't
194 // initialized when it was recorded. 194 // initialized when it was recorded.
195 if (thread_timestamp_ != ThreadTicks()) 195 if (thread_timestamp_ != ThreadTicks())
196 thread_duration_ = thread_now - thread_timestamp_; 196 thread_duration_ = thread_now - thread_timestamp_;
197 } 197 }
198 198
199 void TraceEvent::EstimateTraceMemoryOverhead( 199 void TraceEvent::EstimateTraceMemoryOverhead(
200 TraceEventMemoryOverhead* overhead) { 200 TraceEventMemoryOverhead* overhead) {
201 overhead->Add("TraceEvent", sizeof(*this)); 201 overhead->Add(TraceEventMemoryOverhead::kTraceEvent, sizeof(*this));
202 202
203 if (parameter_copy_storage_) 203 if (parameter_copy_storage_)
204 overhead->AddString(*parameter_copy_storage_); 204 overhead->AddString(*parameter_copy_storage_);
205 205
206 for (size_t i = 0; i < kTraceMaxNumArgs; ++i) { 206 for (size_t i = 0; i < kTraceMaxNumArgs; ++i) {
207 if (arg_types_[i] == TRACE_VALUE_TYPE_CONVERTABLE) 207 if (arg_types_[i] == TRACE_VALUE_TYPE_CONVERTABLE)
208 convertable_values_[i]->EstimateTraceMemoryOverhead(overhead); 208 convertable_values_[i]->EstimateTraceMemoryOverhead(overhead);
209 } 209 }
210 } 210 }
211 211
(...skipping 269 matching lines...) Expand 10 before | Expand all | Expand 10 after
481 base::StringPrintf("0x%" PRIx64, static_cast<uint64_t>(raw_id_))); 481 base::StringPrintf("0x%" PRIx64, static_cast<uint64_t>(raw_id_)));
482 } 482 }
483 483
484 if (id_flags_ != TRACE_EVENT_FLAG_HAS_ID) 484 if (id_flags_ != TRACE_EVENT_FLAG_HAS_ID)
485 value->EndDictionary(); 485 value->EndDictionary();
486 486
487 return std::move(value); 487 return std::move(value);
488 } 488 }
489 489
490 } // namespace trace_event_internal 490 } // namespace trace_event_internal
OLDNEW
« no previous file with comments | « base/trace_event/trace_event_argument.cc ('k') | base/trace_event/trace_event_memory_overhead.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698