Index: src/profiler/heap-profiler.cc |
diff --git a/src/profiler/heap-profiler.cc b/src/profiler/heap-profiler.cc |
index 4403e5d6c9c965cea6851644097200f90b6a64e8..1305cae66ea1ad097c1a726705ebdbb604a556cf 100644 |
--- a/src/profiler/heap-profiler.cc |
+++ b/src/profiler/heap-profiler.cc |
@@ -8,6 +8,7 @@ |
#include "src/debug/debug.h" |
#include "src/profiler/allocation-tracker.h" |
#include "src/profiler/heap-snapshot-generator-inl.h" |
+#include "src/profiler/sampling-heap-profiler.h" |
namespace v8 { |
namespace internal { |
@@ -84,6 +85,31 @@ HeapSnapshot* HeapProfiler::TakeSnapshot( |
} |
+bool HeapProfiler::StartSamplingHeapProfiler(uint64_t sample_interval, |
+ int stack_depth) { |
+ if (sampling_heap_profiler_.get()) { |
+ return false; |
+ } |
+ sampling_heap_profiler_.Reset(new SamplingHeapProfiler( |
+ heap(), names_.get(), sample_interval, stack_depth)); |
+ return true; |
+} |
+ |
+ |
+void HeapProfiler::StopSamplingHeapProfiler() { |
+ sampling_heap_profiler_.Reset(nullptr); |
+} |
+ |
+ |
+v8::AllocationProfile* HeapProfiler::GetAllocationProfile() { |
+ if (sampling_heap_profiler_.get()) { |
+ return sampling_heap_profiler_->GetAllocationProfile(); |
+ } else { |
+ return nullptr; |
+ } |
+} |
+ |
+ |
void HeapProfiler::StartHeapObjectsTracking(bool track_allocations) { |
ids_->UpdateHeapObjectsMap(); |
is_tracking_object_moves_ = true; |