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

Side by Side Diff: src/profiler/heap-profiler.cc

Issue 1615173002: Revert of [profiler] Implement POC Sampling Heap Profiler (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 11 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 unified diff | Download patch
« no previous file with comments | « src/profiler/heap-profiler.h ('k') | src/profiler/sampling-heap-profiler.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2009-2010 the V8 project authors. All rights reserved. 1 // Copyright 2009-2010 the V8 project 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 "src/profiler/heap-profiler.h" 5 #include "src/profiler/heap-profiler.h"
6 6
7 #include "src/api.h" 7 #include "src/api.h"
8 #include "src/debug/debug.h" 8 #include "src/debug/debug.h"
9 #include "src/profiler/allocation-tracker.h" 9 #include "src/profiler/allocation-tracker.h"
10 #include "src/profiler/heap-snapshot-generator-inl.h" 10 #include "src/profiler/heap-snapshot-generator-inl.h"
11 #include "src/profiler/sampling-heap-profiler.h"
12 11
13 namespace v8 { 12 namespace v8 {
14 namespace internal { 13 namespace internal {
15 14
16 HeapProfiler::HeapProfiler(Heap* heap) 15 HeapProfiler::HeapProfiler(Heap* heap)
17 : ids_(new HeapObjectsMap(heap)), 16 : ids_(new HeapObjectsMap(heap)),
18 names_(new StringsStorage(heap)), 17 names_(new StringsStorage(heap)),
19 is_tracking_object_moves_(false) { 18 is_tracking_object_moves_(false) {
20 } 19 }
21 20
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
78 ids_->RemoveDeadEntries(); 77 ids_->RemoveDeadEntries();
79 is_tracking_object_moves_ = true; 78 is_tracking_object_moves_ = true;
80 79
81 heap()->isolate()->debug()->feature_tracker()->Track( 80 heap()->isolate()->debug()->feature_tracker()->Track(
82 DebugFeatureTracker::kHeapSnapshot); 81 DebugFeatureTracker::kHeapSnapshot);
83 82
84 return result; 83 return result;
85 } 84 }
86 85
87 86
88 bool HeapProfiler::StartSamplingHeapProfiler(uint64_t sample_interval,
89 int stack_depth) {
90 if (sampling_heap_profiler_.get()) {
91 return false;
92 }
93 sampling_heap_profiler_.Reset(new SamplingHeapProfiler(
94 heap(), names_.get(), sample_interval, stack_depth));
95 return true;
96 }
97
98
99 void HeapProfiler::StopSamplingHeapProfiler() {
100 sampling_heap_profiler_.Reset(nullptr);
101 }
102
103
104 v8::AllocationProfile* HeapProfiler::GetAllocationProfile() {
105 if (sampling_heap_profiler_.get()) {
106 return sampling_heap_profiler_->GetAllocationProfile();
107 } else {
108 return nullptr;
109 }
110 }
111
112
113 void HeapProfiler::StartHeapObjectsTracking(bool track_allocations) { 87 void HeapProfiler::StartHeapObjectsTracking(bool track_allocations) {
114 ids_->UpdateHeapObjectsMap(); 88 ids_->UpdateHeapObjectsMap();
115 is_tracking_object_moves_ = true; 89 is_tracking_object_moves_ = true;
116 DCHECK(!is_tracking_allocations()); 90 DCHECK(!is_tracking_allocations());
117 if (track_allocations) { 91 if (track_allocations) {
118 allocation_tracker_.Reset(new AllocationTracker(ids_.get(), names_.get())); 92 allocation_tracker_.Reset(new AllocationTracker(ids_.get(), names_.get()));
119 heap()->DisableInlineAllocation(); 93 heap()->DisableInlineAllocation();
120 heap()->isolate()->debug()->feature_tracker()->Track( 94 heap()->isolate()->debug()->feature_tracker()->Track(
121 DebugFeatureTracker::kAllocationTracking); 95 DebugFeatureTracker::kAllocationTracking);
122 } 96 }
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
217 ids_.Reset(new HeapObjectsMap(heap())); 191 ids_.Reset(new HeapObjectsMap(heap()));
218 if (!is_tracking_allocations()) is_tracking_object_moves_ = false; 192 if (!is_tracking_allocations()) is_tracking_object_moves_ = false;
219 } 193 }
220 194
221 195
222 Heap* HeapProfiler::heap() const { return ids_->heap(); } 196 Heap* HeapProfiler::heap() const { return ids_->heap(); }
223 197
224 198
225 } // namespace internal 199 } // namespace internal
226 } // namespace v8 200 } // namespace v8
OLDNEW
« no previous file with comments | « src/profiler/heap-profiler.h ('k') | src/profiler/sampling-heap-profiler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698