| 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 <algorithm> | 7 #include <algorithm> |
| 8 #include <cmath> | 8 #include <cmath> |
| 9 | 9 |
| 10 #include "base/base_switches.h" | 10 #include "base/base_switches.h" |
| (...skipping 353 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 364 return NULL; | 364 return NULL; |
| 365 } | 365 } |
| 366 | 366 |
| 367 scoped_ptr<TraceBuffer> CloneForIteration() const override { | 367 scoped_ptr<TraceBuffer> CloneForIteration() const override { |
| 368 NOTIMPLEMENTED(); | 368 NOTIMPLEMENTED(); |
| 369 return scoped_ptr<TraceBuffer>(); | 369 return scoped_ptr<TraceBuffer>(); |
| 370 } | 370 } |
| 371 | 371 |
| 372 void EstimateTraceMemoryOverhead( | 372 void EstimateTraceMemoryOverhead( |
| 373 TraceEventMemoryOverhead* overhead) override { | 373 TraceEventMemoryOverhead* overhead) override { |
| 374 // Skip the in-flight chunks owned by the threads. They will be accounted | 374 const size_t chunks_ptr_vector_allocated_size = |
| 375 // by the per-thread-local dumper, see ThreadLocalEventBuffer::OnMemoryDump. | 375 sizeof(*this) + max_chunks_ * sizeof(decltype(chunks_)::value_type); |
| 376 overhead->Add("TraceBufferVector", sizeof(*this)); | 376 const size_t chunks_ptr_vector_resident_size = |
| 377 sizeof(*this) + chunks_.size() * sizeof(decltype(chunks_)::value_type); |
| 378 overhead->Add("TraceBufferVector", chunks_ptr_vector_allocated_size, |
| 379 chunks_ptr_vector_resident_size); |
| 377 for (size_t i = 0; i < chunks_.size(); ++i) { | 380 for (size_t i = 0; i < chunks_.size(); ++i) { |
| 378 TraceBufferChunk* chunk = chunks_[i]; | 381 TraceBufferChunk* chunk = chunks_[i]; |
| 382 // Skip the in-flight (nullptr) chunks. They will be accounted by the |
| 383 // per-thread-local dumpers, see ThreadLocalEventBuffer::OnMemoryDump. |
| 379 if (chunk) | 384 if (chunk) |
| 380 chunk->EstimateTraceMemoryOverhead(overhead); | 385 chunk->EstimateTraceMemoryOverhead(overhead); |
| 381 } | 386 } |
| 382 } | 387 } |
| 383 | 388 |
| 384 private: | 389 private: |
| 385 size_t in_flight_chunk_count_; | 390 size_t in_flight_chunk_count_; |
| 386 size_t current_iteration_index_; | 391 size_t current_iteration_index_; |
| 387 size_t max_chunks_; | 392 size_t max_chunks_; |
| 388 ScopedVector<TraceBufferChunk> chunks_; | 393 ScopedVector<TraceBufferChunk> chunks_; |
| (...skipping 2126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2515 } | 2520 } |
| 2516 | 2521 |
| 2517 ScopedTraceBinaryEfficient::~ScopedTraceBinaryEfficient() { | 2522 ScopedTraceBinaryEfficient::~ScopedTraceBinaryEfficient() { |
| 2518 if (*category_group_enabled_) { | 2523 if (*category_group_enabled_) { |
| 2519 TRACE_EVENT_API_UPDATE_TRACE_EVENT_DURATION(category_group_enabled_, | 2524 TRACE_EVENT_API_UPDATE_TRACE_EVENT_DURATION(category_group_enabled_, |
| 2520 name_, event_handle_); | 2525 name_, event_handle_); |
| 2521 } | 2526 } |
| 2522 } | 2527 } |
| 2523 | 2528 |
| 2524 } // namespace trace_event_internal | 2529 } // namespace trace_event_internal |
| OLD | NEW |