5 #ifndef V8_PROFILER_HEAP_PROFILER_H_ 6 #define V8_PROFILER_HEAP_PROFILER_H_ 11 #include "include/v8-profiler.h" 12 #include "src/base/platform/mutex.h" 13 #include "src/debug/debug-interface.h" 14 #include "src/globals.h" 15 #include "src/heap/heap.h" 21 class AllocationTracker;
24 class SamplingHeapProfiler;
36 bool StartSamplingHeapProfiler(uint64_t sample_interval,
int stack_depth,
37 v8::HeapProfiler::SamplingFlags);
38 void StopSamplingHeapProfiler();
39 bool is_sampling_allocations() {
return !!sampling_heap_profiler_; }
42 void StartHeapObjectsTracking(
bool track_allocations);
43 void StopHeapObjectsTracking();
45 return allocation_tracker_.get();
52 int GetSnapshotsCount();
55 void DeleteAllSnapshots();
60 void AllocationEvent(
Address addr,
int size)
override;
62 void UpdateObjectSizeEvent(
Address addr,
int size)
override;
64 void DefineWrapperClass(
70 void SetGetRetainerInfosCallback(
74 void AddBuildEmbedderGraphCallback(
76 void RemoveBuildEmbedderGraphCallback(
79 bool HasBuildEmbedderGraphCallback() {
80 return !build_embedder_graph_callbacks_.empty();
83 bool is_tracking_object_moves()
const {
return is_tracking_object_moves_; }
86 void ClearHeapObjectMap();
95 void MaybeClearStringsStorage();
100 std::unique_ptr<HeapObjectsMap> ids_;
101 std::vector<std::unique_ptr<HeapSnapshot>> snapshots_;
102 std::unique_ptr<StringsStorage> names_;
103 std::vector<v8::HeapProfiler::WrapperInfoCallback> wrapper_callbacks_;
104 std::unique_ptr<AllocationTracker> allocation_tracker_;
105 bool is_tracking_object_moves_;
107 std::unique_ptr<SamplingHeapProfiler> sampling_heap_profiler_;
110 std::vector<std::pair<v8::HeapProfiler::BuildEmbedderGraphCallback, void*>>
111 build_embedder_graph_callbacks_;
119 #endif // V8_PROFILER_HEAP_PROFILER_H_ RetainerInfos(* GetRetainerInfosCallback)(v8::Isolate *isolate)
void(* BuildEmbedderGraphCallback)(v8::Isolate *isolate, v8::EmbedderGraph *graph, void *data)
RetainedObjectInfo *(* WrapperInfoCallback)(uint16_t class_id, Local< Value > wrapper)