| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/heap_profiler_heap_dump_writer.h" | 5 #include "base/trace_event/heap_profiler_heap_dump_writer.h" |
| 6 | 6 |
| 7 #include <stdint.h> | 7 #include <stdint.h> |
| 8 | 8 |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 #include <iterator> | 10 #include <iterator> |
| 11 #include <tuple> | 11 #include <tuple> |
| 12 #include <utility> | 12 #include <utility> |
| 13 #include <vector> | 13 #include <vector> |
| 14 | 14 |
| 15 #include "base/format_macros.h" | 15 #include "base/format_macros.h" |
| 16 #include "base/logging.h" | 16 #include "base/logging.h" |
| 17 #include "base/macros.h" | 17 #include "base/macros.h" |
| 18 #include "base/strings/stringprintf.h" | 18 #include "base/strings/stringprintf.h" |
| 19 #include "base/trace_event/heap_profiler_serialization_state.h" |
| 19 #include "base/trace_event/heap_profiler_stack_frame_deduplicator.h" | 20 #include "base/trace_event/heap_profiler_stack_frame_deduplicator.h" |
| 20 #include "base/trace_event/heap_profiler_type_name_deduplicator.h" | 21 #include "base/trace_event/heap_profiler_type_name_deduplicator.h" |
| 21 #include "base/trace_event/memory_dump_session_state.h" | |
| 22 #include "base/trace_event/trace_config.h" | 22 #include "base/trace_event/trace_config.h" |
| 23 #include "base/trace_event/trace_event_argument.h" | 23 #include "base/trace_event/trace_event_argument.h" |
| 24 #include "base/trace_event/trace_log.h" | 24 #include "base/trace_event/trace_log.h" |
| 25 | 25 |
| 26 // Most of what the |HeapDumpWriter| does is aggregating detailed information | 26 // Most of what the |HeapDumpWriter| does is aggregating detailed information |
| 27 // about the heap and deciding what to dump. The Input to this process is a list | 27 // about the heap and deciding what to dump. The Input to this process is a list |
| 28 // of |AllocationContext|s and size pairs. | 28 // of |AllocationContext|s and size pairs. |
| 29 // | 29 // |
| 30 // The pairs are grouped into |Bucket|s. A bucket is a group of (context, size) | 30 // The pairs are grouped into |Bucket|s. A bucket is a group of (context, size) |
| 31 // pairs where the properties of the contexts share a prefix. (Type name is | 31 // pairs where the properties of the contexts share a prefix. (Type name is |
| (...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 304 | 304 |
| 305 traced_value->EndArray(); // "entries" | 305 traced_value->EndArray(); // "entries" |
| 306 return traced_value; | 306 return traced_value; |
| 307 } | 307 } |
| 308 | 308 |
| 309 } // namespace internal | 309 } // namespace internal |
| 310 | 310 |
| 311 std::unique_ptr<TracedValue> ExportHeapDump( | 311 std::unique_ptr<TracedValue> ExportHeapDump( |
| 312 const std::unordered_map<AllocationContext, AllocationMetrics>& | 312 const std::unordered_map<AllocationContext, AllocationMetrics>& |
| 313 metrics_by_context, | 313 metrics_by_context, |
| 314 const MemoryDumpSessionState& session_state) { | 314 const HeapProfilerSerializationState& heap_profiler_serialization_state) { |
| 315 internal::HeapDumpWriter writer( | 315 internal::HeapDumpWriter writer( |
| 316 session_state.stack_frame_deduplicator(), | 316 heap_profiler_serialization_state.stack_frame_deduplicator(), |
| 317 session_state.type_name_deduplicator(), | 317 heap_profiler_serialization_state.type_name_deduplicator(), |
| 318 session_state.heap_profiler_breakdown_threshold_bytes()); | 318 heap_profiler_serialization_state |
| 319 .heap_profiler_breakdown_threshold_bytes()); |
| 319 return Serialize(writer.Summarize(metrics_by_context)); | 320 return Serialize(writer.Summarize(metrics_by_context)); |
| 320 } | 321 } |
| 321 | 322 |
| 322 } // namespace trace_event | 323 } // namespace trace_event |
| 323 } // namespace base | 324 } // namespace base |
| OLD | NEW |