LCOV - code coverage report
Current view: top level - src/profiler - heap-profiler.h (source / functions) Hit Total Coverage
Test: app.info Lines: 1 1 100.0 %
Date: 2017-10-20 Functions: 1 1 100.0 %

          Line data    Source code
       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
       3             : // found in the LICENSE file.
       4             : 
       5             : #ifndef V8_PROFILER_HEAP_PROFILER_H_
       6             : #define V8_PROFILER_HEAP_PROFILER_H_
       7             : 
       8             : #include <memory>
       9             : #include <vector>
      10             : 
      11             : #include "src/isolate.h"
      12             : 
      13             : namespace v8 {
      14             : namespace internal {
      15             : 
      16             : // Forward declarations.
      17             : class AllocationTracker;
      18             : class HeapObjectsMap;
      19             : class HeapSnapshot;
      20             : class SamplingHeapProfiler;
      21             : class StringsStorage;
      22             : 
      23             : class HeapProfiler {
      24             :  public:
      25             :   explicit HeapProfiler(Heap* heap);
      26             :   ~HeapProfiler();
      27             : 
      28             :   HeapSnapshot* TakeSnapshot(
      29             :       v8::ActivityControl* control,
      30             :       v8::HeapProfiler::ObjectNameResolver* resolver);
      31             : 
      32             :   bool StartSamplingHeapProfiler(uint64_t sample_interval, int stack_depth,
      33             :                                  v8::HeapProfiler::SamplingFlags);
      34             :   void StopSamplingHeapProfiler();
      35             :   bool is_sampling_allocations() { return !!sampling_heap_profiler_; }
      36             :   AllocationProfile* GetAllocationProfile();
      37             : 
      38             :   void StartHeapObjectsTracking(bool track_allocations);
      39             :   void StopHeapObjectsTracking();
      40             :   AllocationTracker* allocation_tracker() const {
      41             :     return allocation_tracker_.get();
      42             :   }
      43             :   HeapObjectsMap* heap_object_map() const { return ids_.get(); }
      44             :   StringsStorage* names() const { return names_.get(); }
      45             : 
      46             :   SnapshotObjectId PushHeapObjectsStats(OutputStream* stream,
      47             :                                         int64_t* timestamp_us);
      48             :   int GetSnapshotsCount();
      49             :   HeapSnapshot* GetSnapshot(int index);
      50             :   SnapshotObjectId GetSnapshotObjectId(Handle<Object> obj);
      51             :   void DeleteAllSnapshots();
      52             :   void RemoveSnapshot(HeapSnapshot* snapshot);
      53             : 
      54             :   void ObjectMoveEvent(Address from, Address to, int size);
      55             : 
      56             :   void AllocationEvent(Address addr, int size);
      57             : 
      58             :   void UpdateObjectSizeEvent(Address addr, int size);
      59             : 
      60             :   void DefineWrapperClass(
      61             :       uint16_t class_id, v8::HeapProfiler::WrapperInfoCallback callback);
      62             : 
      63             :   v8::RetainedObjectInfo* ExecuteWrapperClassCallback(uint16_t class_id,
      64             :                                                       Object** wrapper);
      65             : 
      66             :   void SetGetRetainerInfosCallback(
      67             :       v8::HeapProfiler::GetRetainerInfosCallback callback);
      68             : 
      69             :   v8::HeapProfiler::RetainerInfos GetRetainerInfos(Isolate* isolate);
      70             : 
      71             :   bool is_tracking_object_moves() const { return is_tracking_object_moves_; }
      72             :   bool is_tracking_allocations() const { return !!allocation_tracker_; }
      73             : 
      74             :   Handle<HeapObject> FindHeapObjectById(SnapshotObjectId id);
      75             :   void ClearHeapObjectMap();
      76             : 
      77    12017759 :   Isolate* isolate() const { return heap()->isolate(); }
      78             : 
      79             :   void QueryObjects(Handle<Context> context,
      80             :                     debug::QueryObjectPredicate* predicate,
      81             :                     v8::PersistentValueVector<v8::Object>* objects);
      82             : 
      83             :  private:
      84             :   Heap* heap() const;
      85             : 
      86             :   // Mapping from HeapObject addresses to objects' uids.
      87             :   std::unique_ptr<HeapObjectsMap> ids_;
      88             :   std::vector<HeapSnapshot*> snapshots_;
      89             :   std::unique_ptr<StringsStorage> names_;
      90             :   std::vector<v8::HeapProfiler::WrapperInfoCallback> wrapper_callbacks_;
      91             :   std::unique_ptr<AllocationTracker> allocation_tracker_;
      92             :   bool is_tracking_object_moves_;
      93             :   base::Mutex profiler_mutex_;
      94             :   std::unique_ptr<SamplingHeapProfiler> sampling_heap_profiler_;
      95             :   v8::HeapProfiler::GetRetainerInfosCallback get_retainer_infos_callback_;
      96             : 
      97             :   DISALLOW_COPY_AND_ASSIGN(HeapProfiler);
      98             : };
      99             : 
     100             : }  // namespace internal
     101             : }  // namespace v8
     102             : 
     103             : #endif  // V8_PROFILER_HEAP_PROFILER_H_

Generated by: LCOV version 1.10