| OLD | NEW |
| 1 // Copyright 2015 the V8 project authors. All rights reserved. | 1 // Copyright 2015 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_SAMPLING_HEAP_PROFILER_H_ | 5 #ifndef V8_PROFILER_SAMPLING_HEAP_PROFILER_H_ |
| 6 #define V8_PROFILER_SAMPLING_HEAP_PROFILER_H_ | 6 #define V8_PROFILER_SAMPLING_HEAP_PROFILER_H_ |
| 7 | 7 |
| 8 #include <deque> | 8 #include <deque> |
| 9 #include <map> | 9 #include <map> |
| 10 #include <set> | 10 #include <set> |
| (...skipping 23 matching lines...) Expand all Loading... |
| 34 | 34 |
| 35 private: | 35 private: |
| 36 std::deque<v8::AllocationProfile::Node> nodes_; | 36 std::deque<v8::AllocationProfile::Node> nodes_; |
| 37 | 37 |
| 38 DISALLOW_COPY_AND_ASSIGN(AllocationProfile); | 38 DISALLOW_COPY_AND_ASSIGN(AllocationProfile); |
| 39 }; | 39 }; |
| 40 | 40 |
| 41 class SamplingHeapProfiler { | 41 class SamplingHeapProfiler { |
| 42 public: | 42 public: |
| 43 SamplingHeapProfiler(Heap* heap, StringsStorage* names, uint64_t rate, | 43 SamplingHeapProfiler(Heap* heap, StringsStorage* names, uint64_t rate, |
| 44 int stack_depth); | 44 int stack_depth, v8::HeapProfiler::SamplingFlags flags); |
| 45 ~SamplingHeapProfiler(); | 45 ~SamplingHeapProfiler(); |
| 46 | 46 |
| 47 v8::AllocationProfile* GetAllocationProfile(); | 47 v8::AllocationProfile* GetAllocationProfile(); |
| 48 | 48 |
| 49 StringsStorage* names() const { return names_; } | 49 StringsStorage* names() const { return names_; } |
| 50 | 50 |
| 51 class AllocationNode; | 51 class AllocationNode; |
| 52 | 52 |
| 53 struct Sample { | 53 struct Sample { |
| 54 public: | 54 public: |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 123 | 123 |
| 124 Isolate* const isolate_; | 124 Isolate* const isolate_; |
| 125 Heap* const heap_; | 125 Heap* const heap_; |
| 126 base::SmartPointer<SamplingAllocationObserver> new_space_observer_; | 126 base::SmartPointer<SamplingAllocationObserver> new_space_observer_; |
| 127 base::SmartPointer<SamplingAllocationObserver> other_spaces_observer_; | 127 base::SmartPointer<SamplingAllocationObserver> other_spaces_observer_; |
| 128 StringsStorage* const names_; | 128 StringsStorage* const names_; |
| 129 AllocationNode profile_root_; | 129 AllocationNode profile_root_; |
| 130 std::set<Sample*> samples_; | 130 std::set<Sample*> samples_; |
| 131 const int stack_depth_; | 131 const int stack_depth_; |
| 132 const uint64_t rate_; | 132 const uint64_t rate_; |
| 133 v8::HeapProfiler::SamplingFlags flags_; |
| 133 | 134 |
| 134 friend class SamplingAllocationObserver; | 135 friend class SamplingAllocationObserver; |
| 135 }; | 136 }; |
| 136 | 137 |
| 137 class SamplingAllocationObserver : public AllocationObserver { | 138 class SamplingAllocationObserver : public AllocationObserver { |
| 138 public: | 139 public: |
| 139 SamplingAllocationObserver(Heap* heap, intptr_t step_size, uint64_t rate, | 140 SamplingAllocationObserver(Heap* heap, intptr_t step_size, uint64_t rate, |
| 140 SamplingHeapProfiler* profiler, | 141 SamplingHeapProfiler* profiler, |
| 141 base::RandomNumberGenerator* random) | 142 base::RandomNumberGenerator* random) |
| 142 : AllocationObserver(step_size), | 143 : AllocationObserver(step_size), |
| (...skipping 18 matching lines...) Expand all Loading... |
| 161 SamplingHeapProfiler* const profiler_; | 162 SamplingHeapProfiler* const profiler_; |
| 162 Heap* const heap_; | 163 Heap* const heap_; |
| 163 base::RandomNumberGenerator* const random_; | 164 base::RandomNumberGenerator* const random_; |
| 164 uint64_t const rate_; | 165 uint64_t const rate_; |
| 165 }; | 166 }; |
| 166 | 167 |
| 167 } // namespace internal | 168 } // namespace internal |
| 168 } // namespace v8 | 169 } // namespace v8 |
| 169 | 170 |
| 170 #endif // V8_PROFILER_SAMPLING_HEAP_PROFILER_H_ | 171 #endif // V8_PROFILER_SAMPLING_HEAP_PROFILER_H_ |
| OLD | NEW |