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_PROFILER_HEAP_PROFILER_H_ | 5 #ifndef V8_PROFILER_HEAP_PROFILER_H_ |
6 #define V8_PROFILER_HEAP_PROFILER_H_ | 6 #define V8_PROFILER_HEAP_PROFILER_H_ |
7 | 7 |
8 #include "src/base/smart-pointers.h" | 8 #include "src/base/smart-pointers.h" |
9 #include "src/isolate.h" | 9 #include "src/isolate.h" |
10 #include "src/list.h" | 10 #include "src/list.h" |
11 | 11 |
12 namespace v8 { | 12 namespace v8 { |
13 namespace internal { | 13 namespace internal { |
14 | 14 |
15 // Forward declarations. | 15 // Forward declarations. |
16 class AllocationTracker; | 16 class AllocationTracker; |
17 class HeapObjectsMap; | 17 class HeapObjectsMap; |
18 class HeapSnapshot; | 18 class HeapSnapshot; |
| 19 class SamplingHeapProfiler; |
19 class StringsStorage; | 20 class StringsStorage; |
20 | 21 |
21 class HeapProfiler { | 22 class HeapProfiler { |
22 public: | 23 public: |
23 explicit HeapProfiler(Heap* heap); | 24 explicit HeapProfiler(Heap* heap); |
24 ~HeapProfiler(); | 25 ~HeapProfiler(); |
25 | 26 |
26 size_t GetMemorySizeUsedByProfiler(); | 27 size_t GetMemorySizeUsedByProfiler(); |
27 | 28 |
28 HeapSnapshot* TakeSnapshot( | 29 HeapSnapshot* TakeSnapshot( |
29 v8::ActivityControl* control, | 30 v8::ActivityControl* control, |
30 v8::HeapProfiler::ObjectNameResolver* resolver); | 31 v8::HeapProfiler::ObjectNameResolver* resolver); |
31 | 32 |
| 33 bool StartSamplingHeapProfiler(uint64_t sample_interval, int stack_depth); |
| 34 void StopSamplingHeapProfiler(); |
| 35 AllocationProfile* GetAllocationProfile(); |
| 36 |
32 void StartHeapObjectsTracking(bool track_allocations); | 37 void StartHeapObjectsTracking(bool track_allocations); |
33 void StopHeapObjectsTracking(); | 38 void StopHeapObjectsTracking(); |
34 AllocationTracker* allocation_tracker() const { | 39 AllocationTracker* allocation_tracker() const { |
35 return allocation_tracker_.get(); | 40 return allocation_tracker_.get(); |
36 } | 41 } |
37 HeapObjectsMap* heap_object_map() const { return ids_.get(); } | 42 HeapObjectsMap* heap_object_map() const { return ids_.get(); } |
38 StringsStorage* names() const { return names_.get(); } | 43 StringsStorage* names() const { return names_.get(); } |
39 | 44 |
40 SnapshotObjectId PushHeapObjectsStats(OutputStream* stream, | 45 SnapshotObjectId PushHeapObjectsStats(OutputStream* stream, |
41 int64_t* timestamp_us); | 46 int64_t* timestamp_us); |
(...skipping 30 matching lines...) Expand all Loading... |
72 Heap* heap() const; | 77 Heap* heap() const; |
73 | 78 |
74 // Mapping from HeapObject addresses to objects' uids. | 79 // Mapping from HeapObject addresses to objects' uids. |
75 base::SmartPointer<HeapObjectsMap> ids_; | 80 base::SmartPointer<HeapObjectsMap> ids_; |
76 List<HeapSnapshot*> snapshots_; | 81 List<HeapSnapshot*> snapshots_; |
77 base::SmartPointer<StringsStorage> names_; | 82 base::SmartPointer<StringsStorage> names_; |
78 List<v8::HeapProfiler::WrapperInfoCallback> wrapper_callbacks_; | 83 List<v8::HeapProfiler::WrapperInfoCallback> wrapper_callbacks_; |
79 base::SmartPointer<AllocationTracker> allocation_tracker_; | 84 base::SmartPointer<AllocationTracker> allocation_tracker_; |
80 bool is_tracking_object_moves_; | 85 bool is_tracking_object_moves_; |
81 base::Mutex profiler_mutex_; | 86 base::Mutex profiler_mutex_; |
| 87 base::SmartPointer<SamplingHeapProfiler> sampling_heap_profiler_; |
82 }; | 88 }; |
83 | 89 |
84 } // namespace internal | 90 } // namespace internal |
85 } // namespace v8 | 91 } // namespace v8 |
86 | 92 |
87 #endif // V8_PROFILER_HEAP_PROFILER_H_ | 93 #endif // V8_PROFILER_HEAP_PROFILER_H_ |
OLD | NEW |