Chromium Code Reviews| Index: base/trace_event/heap_profiler_heap_dump_writer.cc |
| diff --git a/base/trace_event/heap_profiler_heap_dump_writer.cc b/base/trace_event/heap_profiler_heap_dump_writer.cc |
| index b94c31246b9d347d42c285d04878c586ed7f9163..da68cd8840d09b58c9f726cc0fd038b87475dbdc 100644 |
| --- a/base/trace_event/heap_profiler_heap_dump_writer.cc |
| +++ b/base/trace_event/heap_profiler_heap_dump_writer.cc |
| @@ -66,14 +66,14 @@ bool operator<(const Bucket& lhs, const Bucket& rhs) { |
| // returned list will have |backtrace_cursor| advanced or |
| // |is_broken_down_by_type_name| set depending on the property to group by. |
| std::vector<Bucket> GetSubbuckets(const Bucket& bucket, BreakDownMode breakBy) { |
| - base::hash_map<const char*, Bucket> breakdown; |
| + base::hash_map<StackFrame, Bucket> breakdown; |
| if (breakBy == BreakDownMode::kByBacktrace) { |
| for (const auto& context_and_size : bucket.bytes_by_context) { |
| const Backtrace& backtrace = context_and_size.first->backtrace; |
| - const char* const* begin = std::begin(backtrace.frames); |
| - const char* const* end = std::end(backtrace.frames); |
| - const char* const* cursor = begin + bucket.backtrace_cursor; |
| + const StackFrame* begin = std::begin(backtrace.frames); |
|
Primiano Tucci (use gerrit)
2016/04/01 15:56:28
if StackFrame is "const char*", I think
const char
Dmitry Skiba
2016/04/04 22:38:34
Actually, 'const StackFrame*' and 'StackFrame cons
|
| + const StackFrame* end = std::end(backtrace.frames); |
| + const StackFrame* cursor = begin + bucket.backtrace_cursor; |
| // The backtrace in the context is padded with null pointers, but these |
| // should not be considered for breakdown. Adjust end to point past the |
| @@ -189,13 +189,13 @@ bool HeapDumpWriter::AddEntryForBucket(const Bucket& bucket) { |
| const AllocationContext* context = bucket.bytes_by_context.front().first; |
| - const char* const* backtrace_begin = std::begin(context->backtrace.frames); |
| - const char* const* backtrace_end = backtrace_begin + bucket.backtrace_cursor; |
| + const StackFrame* backtrace_begin = std::begin(context->backtrace.frames); |
| + const StackFrame* backtrace_end = backtrace_begin + bucket.backtrace_cursor; |
| DCHECK_LE(bucket.backtrace_cursor, arraysize(context->backtrace.frames)); |
| Entry entry; |
| - entry.stack_frame_id = |
| - stack_frame_deduplicator_->Insert(backtrace_begin, backtrace_end); |
| + entry.stack_frame_id = stack_frame_deduplicator_->Insert( |
| + context->backtrace.frame_type, backtrace_begin, backtrace_end); |
| // Deduplicate the type name, or use ID -1 if type name is not set. |
| entry.type_id = bucket.is_broken_down_by_type_name |
| @@ -236,8 +236,11 @@ const std::set<Entry>& HeapDumpWriter::Summarize( |
| for (const auto& context_and_size : bytes_by_context) { |
| const AllocationContext* context = &context_and_size.first; |
| const size_t size = context_and_size.second; |
| - root_bucket.bytes_by_context.push_back(std::make_pair(context, size)); |
| - root_bucket.size += size; |
| + if (size != 0) { |
|
Primiano Tucci (use gerrit)
2016/04/01 15:56:28
uh do we see any zero allocations?
Dmitry Skiba
2016/04/04 22:38:34
Yup. Maybe we need to ignore them earlier, in Mall
|
| + // GetSubbuckets() expects non-zero allocations |
| + root_bucket.bytes_by_context.push_back(std::make_pair(context, size)); |
| + root_bucket.size += size; |
| + } |
| } |
| AddEntryForBucket(root_bucket); |