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

Unified Diff: base/trace_event/trace_event_impl.cc

Issue 1226933002: [tracing] Fix memory overhead accounting of TraceBufferVector (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/trace_event/trace_event_impl.cc
diff --git a/base/trace_event/trace_event_impl.cc b/base/trace_event/trace_event_impl.cc
index fb39519e5d58c380134a3c5e57708977e103f526..9d17f4f6f1783210e8d9f36af4b46f87d48db84c 100644
--- a/base/trace_event/trace_event_impl.cc
+++ b/base/trace_event/trace_event_impl.cc
@@ -371,11 +371,16 @@ class TraceBufferVector : public TraceBuffer {
void EstimateTraceMemoryOverhead(
TraceEventMemoryOverhead* overhead) override {
- // Skip the in-flight chunks owned by the threads. They will be accounted
- // by the per-thread-local dumper, see ThreadLocalEventBuffer::OnMemoryDump.
- overhead->Add("TraceBufferVector", sizeof(*this));
+ const size_t chunks_ptr_vector_allocated_size =
+ sizeof(*this) + max_chunks_ * sizeof(decltype(chunks_)::value_type);
+ const size_t chunks_ptr_vector_resident_size =
+ sizeof(*this) + chunks_.size() * sizeof(decltype(chunks_)::value_type);
+ overhead->Add("TraceBufferVector", chunks_ptr_vector_allocated_size,
+ chunks_ptr_vector_resident_size);
for (size_t i = 0; i < chunks_.size(); ++i) {
TraceBufferChunk* chunk = chunks_[i];
+ // Skip the in-flight (nullptr) chunks. They will be accounted by the
+ // per-thread-local dumpers, see ThreadLocalEventBuffer::OnMemoryDump.
if (chunk)
chunk->EstimateTraceMemoryOverhead(overhead);
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698