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

Unified Diff: src/profiler/heap-profiler.cc

Issue 1555553002: [profiler] Implement POC Sampling Heap Profiler (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: increase sampling frequency in tests to reduce random chance failure likelihood 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 side-by-side diff with in-line comments
Download patch
Index: src/profiler/heap-profiler.cc
diff --git a/src/profiler/heap-profiler.cc b/src/profiler/heap-profiler.cc
index 4403e5d6c9c965cea6851644097200f90b6a64e8..c80f33264f9cdf6d8e050d470a8bffb439e18e44 100644
--- a/src/profiler/heap-profiler.cc
+++ b/src/profiler/heap-profiler.cc
@@ -5,9 +5,12 @@
#include "src/profiler/heap-profiler.h"
#include "src/api.h"
+#include "src/base/utils/random-number-generator.h"
alph 2016/01/20 23:13:01 not used?
ofrobots 2016/01/21 03:03:28 Done.
#include "src/debug/debug.h"
+#include "src/frames-inl.h"
alph 2016/01/20 23:13:01 ditto
ofrobots 2016/01/21 03:03:28 Done.
#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 +87,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;

Powered by Google App Engine
This is Rietveld 408576698