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