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_stack_frame_deduplicator.h" | 5 #include "base/trace_event/heap_profiler_stack_frame_deduplicator.h" |
6 | 6 |
7 #include <inttypes.h> | |
8 #include <stddef.h> | 7 #include <stddef.h> |
9 | 8 |
10 #include <string> | 9 #include <string> |
11 #include <utility> | 10 #include <utility> |
12 | 11 |
13 #include "base/strings/stringprintf.h" | 12 #include "base/strings/stringprintf.h" |
14 #include "base/trace_event/trace_event_argument.h" | 13 #include "base/trace_event/trace_event_argument.h" |
15 #include "base/trace_event/trace_event_memory_overhead.h" | 14 #include "base/trace_event/trace_event_memory_overhead.h" |
16 | 15 |
17 namespace base { | 16 namespace base { |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
84 case StackFrame::Type::TRACE_EVENT_NAME: | 83 case StackFrame::Type::TRACE_EVENT_NAME: |
85 frame_node_value->SetString( | 84 frame_node_value->SetString( |
86 "name", static_cast<const char*>(frame.value)); | 85 "name", static_cast<const char*>(frame.value)); |
87 break; | 86 break; |
88 case StackFrame::Type::THREAD_NAME: | 87 case StackFrame::Type::THREAD_NAME: |
89 SStringPrintf(&stringify_buffer, | 88 SStringPrintf(&stringify_buffer, |
90 "[Thread: %s]", | 89 "[Thread: %s]", |
91 static_cast<const char*>(frame.value)); | 90 static_cast<const char*>(frame.value)); |
92 frame_node_value->SetString("name", stringify_buffer); | 91 frame_node_value->SetString("name", stringify_buffer); |
93 break; | 92 break; |
94 case StackFrame::Type::PROGRAM_COUNTER: | |
95 SStringPrintf(&stringify_buffer, | |
96 "pc:%" PRIxPTR, | |
97 reinterpret_cast<uintptr_t>(frame.value)); | |
98 frame_node_value->SetString("name", stringify_buffer); | |
99 break; | |
100 } | 93 } |
101 if (frame_node->parent_frame_index >= 0) { | 94 if (frame_node->parent_frame_index >= 0) { |
102 SStringPrintf(&stringify_buffer, "%d", frame_node->parent_frame_index); | 95 SStringPrintf(&stringify_buffer, "%d", frame_node->parent_frame_index); |
103 frame_node_value->SetString("parent", stringify_buffer); | 96 frame_node_value->SetString("parent", stringify_buffer); |
104 } | 97 } |
105 frame_node_value->AppendAsTraceFormat(out); | 98 frame_node_value->AppendAsTraceFormat(out); |
106 | 99 |
107 i++; | 100 i++; |
108 frame_node++; | 101 frame_node++; |
109 | 102 |
(...skipping 16 matching lines...) Expand all Loading... |
126 for (const FrameNode& node : frames_) | 119 for (const FrameNode& node : frames_) |
127 maps_size += node.children.size() * sizeof(std::pair<StackFrame, int>); | 120 maps_size += node.children.size() * sizeof(std::pair<StackFrame, int>); |
128 | 121 |
129 overhead->Add("StackFrameDeduplicator", | 122 overhead->Add("StackFrameDeduplicator", |
130 sizeof(StackFrameDeduplicator) + maps_size + frames_allocated, | 123 sizeof(StackFrameDeduplicator) + maps_size + frames_allocated, |
131 sizeof(StackFrameDeduplicator) + maps_size + frames_resident); | 124 sizeof(StackFrameDeduplicator) + maps_size + frames_resident); |
132 } | 125 } |
133 | 126 |
134 } // namespace trace_event | 127 } // namespace trace_event |
135 } // namespace base | 128 } // namespace base |
OLD | NEW |