| 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 <memory> |
| 10 #include <set> | 11 #include <set> |
| 11 #include "include/v8-profiler.h" | 12 #include "include/v8-profiler.h" |
| 12 #include "src/heap/heap.h" | 13 #include "src/heap/heap.h" |
| 13 #include "src/profiler/strings-storage.h" | 14 #include "src/profiler/strings-storage.h" |
| 14 | 15 |
| 15 namespace v8 { | 16 namespace v8 { |
| 16 | 17 |
| 17 namespace base { | 18 namespace base { |
| 18 class RandomNumberGenerator; | 19 class RandomNumberGenerator; |
| 19 } | 20 } |
| (...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 134 // loaded scripts keyed by their script id. | 135 // loaded scripts keyed by their script id. |
| 135 v8::AllocationProfile::Node* TranslateAllocationNode( | 136 v8::AllocationProfile::Node* TranslateAllocationNode( |
| 136 AllocationProfile* profile, SamplingHeapProfiler::AllocationNode* node, | 137 AllocationProfile* profile, SamplingHeapProfiler::AllocationNode* node, |
| 137 const std::map<int, Handle<Script>>& scripts); | 138 const std::map<int, Handle<Script>>& scripts); |
| 138 v8::AllocationProfile::Allocation ScaleSample(size_t size, | 139 v8::AllocationProfile::Allocation ScaleSample(size_t size, |
| 139 unsigned int count); | 140 unsigned int count); |
| 140 AllocationNode* AddStack(); | 141 AllocationNode* AddStack(); |
| 141 | 142 |
| 142 Isolate* const isolate_; | 143 Isolate* const isolate_; |
| 143 Heap* const heap_; | 144 Heap* const heap_; |
| 144 base::SmartPointer<SamplingAllocationObserver> new_space_observer_; | 145 std::unique_ptr<SamplingAllocationObserver> new_space_observer_; |
| 145 base::SmartPointer<SamplingAllocationObserver> other_spaces_observer_; | 146 std::unique_ptr<SamplingAllocationObserver> other_spaces_observer_; |
| 146 StringsStorage* const names_; | 147 StringsStorage* const names_; |
| 147 AllocationNode profile_root_; | 148 AllocationNode profile_root_; |
| 148 std::set<Sample*> samples_; | 149 std::set<Sample*> samples_; |
| 149 const int stack_depth_; | 150 const int stack_depth_; |
| 150 const uint64_t rate_; | 151 const uint64_t rate_; |
| 151 v8::HeapProfiler::SamplingFlags flags_; | 152 v8::HeapProfiler::SamplingFlags flags_; |
| 152 | 153 |
| 153 friend class SamplingAllocationObserver; | 154 friend class SamplingAllocationObserver; |
| 155 |
| 156 DISALLOW_COPY_AND_ASSIGN(SamplingHeapProfiler); |
| 154 }; | 157 }; |
| 155 | 158 |
| 156 class SamplingAllocationObserver : public AllocationObserver { | 159 class SamplingAllocationObserver : public AllocationObserver { |
| 157 public: | 160 public: |
| 158 SamplingAllocationObserver(Heap* heap, intptr_t step_size, uint64_t rate, | 161 SamplingAllocationObserver(Heap* heap, intptr_t step_size, uint64_t rate, |
| 159 SamplingHeapProfiler* profiler, | 162 SamplingHeapProfiler* profiler, |
| 160 base::RandomNumberGenerator* random) | 163 base::RandomNumberGenerator* random) |
| 161 : AllocationObserver(step_size), | 164 : AllocationObserver(step_size), |
| 162 profiler_(profiler), | 165 profiler_(profiler), |
| 163 heap_(heap), | 166 heap_(heap), |
| (...skipping 16 matching lines...) Expand all Loading... |
| 180 SamplingHeapProfiler* const profiler_; | 183 SamplingHeapProfiler* const profiler_; |
| 181 Heap* const heap_; | 184 Heap* const heap_; |
| 182 base::RandomNumberGenerator* const random_; | 185 base::RandomNumberGenerator* const random_; |
| 183 uint64_t const rate_; | 186 uint64_t const rate_; |
| 184 }; | 187 }; |
| 185 | 188 |
| 186 } // namespace internal | 189 } // namespace internal |
| 187 } // namespace v8 | 190 } // namespace v8 |
| 188 | 191 |
| 189 #endif // V8_PROFILER_SAMPLING_HEAP_PROFILER_H_ | 192 #endif // V8_PROFILER_SAMPLING_HEAP_PROFILER_H_ |
| OLD | NEW |