OLD | NEW |
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 #ifndef V8_HEAP_PROFILER_H_ | 5 #ifndef V8_HEAP_PROFILER_H_ |
6 #define V8_HEAP_PROFILER_H_ | 6 #define V8_HEAP_PROFILER_H_ |
7 | 7 |
8 #include "src/heap-snapshot-generator-inl.h" | 8 #include "src/heap-snapshot-generator-inl.h" |
9 #include "src/isolate.h" | 9 #include "src/isolate.h" |
10 #include "src/smart-pointers.h" | 10 #include "src/smart-pointers.h" |
11 | 11 |
12 namespace v8 { | 12 namespace v8 { |
13 namespace internal { | 13 namespace internal { |
14 | 14 |
15 class HeapSnapshot; | 15 class HeapSnapshot; |
16 | 16 |
17 class HeapProfiler { | 17 class HeapProfiler { |
18 public: | 18 public: |
19 explicit HeapProfiler(Heap* heap); | 19 explicit HeapProfiler(Heap* heap); |
20 ~HeapProfiler(); | 20 ~HeapProfiler(); |
21 | 21 |
22 size_t GetMemorySizeUsedByProfiler(); | 22 size_t GetMemorySizeUsedByProfiler(); |
23 | 23 |
24 HeapSnapshot* TakeSnapshot( | 24 HeapSnapshot* TakeSnapshot( |
25 const char* name, | |
26 v8::ActivityControl* control, | |
27 v8::HeapProfiler::ObjectNameResolver* resolver); | |
28 HeapSnapshot* TakeSnapshot( | |
29 String* name, | |
30 v8::ActivityControl* control, | 25 v8::ActivityControl* control, |
31 v8::HeapProfiler::ObjectNameResolver* resolver); | 26 v8::HeapProfiler::ObjectNameResolver* resolver); |
32 | 27 |
33 void StartHeapObjectsTracking(bool track_allocations); | 28 void StartHeapObjectsTracking(bool track_allocations); |
34 void StopHeapObjectsTracking(); | 29 void StopHeapObjectsTracking(); |
35 AllocationTracker* allocation_tracker() const { | 30 AllocationTracker* allocation_tracker() const { |
36 return allocation_tracker_.get(); | 31 return allocation_tracker_.get(); |
37 } | 32 } |
38 HeapObjectsMap* heap_object_map() const { return ids_.get(); } | 33 HeapObjectsMap* heap_object_map() const { return ids_.get(); } |
39 StringsStorage* names() const { return names_.get(); } | 34 StringsStorage* names() const { return names_.get(); } |
(...skipping 26 matching lines...) Loading... |
66 Handle<HeapObject> FindHeapObjectById(SnapshotObjectId id); | 61 Handle<HeapObject> FindHeapObjectById(SnapshotObjectId id); |
67 void ClearHeapObjectMap(); | 62 void ClearHeapObjectMap(); |
68 | 63 |
69 private: | 64 private: |
70 Heap* heap() const { return ids_->heap(); } | 65 Heap* heap() const { return ids_->heap(); } |
71 | 66 |
72 // Mapping from HeapObject addresses to objects' uids. | 67 // Mapping from HeapObject addresses to objects' uids. |
73 SmartPointer<HeapObjectsMap> ids_; | 68 SmartPointer<HeapObjectsMap> ids_; |
74 List<HeapSnapshot*> snapshots_; | 69 List<HeapSnapshot*> snapshots_; |
75 SmartPointer<StringsStorage> names_; | 70 SmartPointer<StringsStorage> names_; |
76 unsigned next_snapshot_uid_; | |
77 List<v8::HeapProfiler::WrapperInfoCallback> wrapper_callbacks_; | 71 List<v8::HeapProfiler::WrapperInfoCallback> wrapper_callbacks_; |
78 SmartPointer<AllocationTracker> allocation_tracker_; | 72 SmartPointer<AllocationTracker> allocation_tracker_; |
79 bool is_tracking_object_moves_; | 73 bool is_tracking_object_moves_; |
80 }; | 74 }; |
81 | 75 |
82 } } // namespace v8::internal | 76 } } // namespace v8::internal |
83 | 77 |
84 #endif // V8_HEAP_PROFILER_H_ | 78 #endif // V8_HEAP_PROFILER_H_ |
OLD | NEW |