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 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
104 // Methods that construct v8::AllocationProfile. | 104 // Methods that construct v8::AllocationProfile. |
105 | 105 |
106 // Translates the provided AllocationNode *node* returning an equivalent | 106 // Translates the provided AllocationNode *node* returning an equivalent |
107 // AllocationProfile::Node. The newly created AllocationProfile::Node is added | 107 // AllocationProfile::Node. The newly created AllocationProfile::Node is added |
108 // to the provided AllocationProfile *profile*. Line numbers, column numbers, | 108 // to the provided AllocationProfile *profile*. Line numbers, column numbers, |
109 // and script names are resolved using *scripts* which maps all currently | 109 // and script names are resolved using *scripts* which maps all currently |
110 // loaded scripts keyed by their script id. | 110 // loaded scripts keyed by their script id. |
111 v8::AllocationProfile::Node* TranslateAllocationNode( | 111 v8::AllocationProfile::Node* TranslateAllocationNode( |
112 AllocationProfile* profile, SamplingHeapProfiler::AllocationNode* node, | 112 AllocationProfile* profile, SamplingHeapProfiler::AllocationNode* node, |
113 const std::map<int, Script*>& scripts); | 113 const std::map<int, Script*>& scripts); |
| 114 v8::AllocationProfile::Allocation ScaleSample(size_t size, |
| 115 unsigned int count); |
114 AllocationNode* AddStack(); | 116 AllocationNode* AddStack(); |
115 AllocationNode* FindOrAddChildNode(AllocationNode* parent, const char* name, | 117 AllocationNode* FindOrAddChildNode(AllocationNode* parent, const char* name, |
116 int script_id, int start_position); | 118 int script_id, int start_position); |
117 | 119 |
118 Isolate* const isolate_; | 120 Isolate* const isolate_; |
119 Heap* const heap_; | 121 Heap* const heap_; |
120 base::SmartPointer<SamplingAllocationObserver> new_space_observer_; | 122 base::SmartPointer<SamplingAllocationObserver> new_space_observer_; |
121 base::SmartPointer<SamplingAllocationObserver> other_spaces_observer_; | 123 base::SmartPointer<SamplingAllocationObserver> other_spaces_observer_; |
122 StringsStorage* const names_; | 124 StringsStorage* const names_; |
123 AllocationNode profile_root_; | 125 AllocationNode profile_root_; |
124 std::set<Sample*> samples_; | 126 std::set<Sample*> samples_; |
125 const int stack_depth_; | 127 const int stack_depth_; |
| 128 const uint64_t rate_; |
126 | 129 |
127 friend class SamplingAllocationObserver; | 130 friend class SamplingAllocationObserver; |
128 }; | 131 }; |
129 | 132 |
130 class SamplingAllocationObserver : public AllocationObserver { | 133 class SamplingAllocationObserver : public AllocationObserver { |
131 public: | 134 public: |
132 SamplingAllocationObserver(Heap* heap, intptr_t step_size, uint64_t rate, | 135 SamplingAllocationObserver(Heap* heap, intptr_t step_size, uint64_t rate, |
133 SamplingHeapProfiler* profiler, | 136 SamplingHeapProfiler* profiler, |
134 base::RandomNumberGenerator* random) | 137 base::RandomNumberGenerator* random) |
135 : AllocationObserver(step_size), | 138 : AllocationObserver(step_size), |
(...skipping 18 matching lines...) Expand all Loading... |
154 SamplingHeapProfiler* const profiler_; | 157 SamplingHeapProfiler* const profiler_; |
155 Heap* const heap_; | 158 Heap* const heap_; |
156 base::RandomNumberGenerator* const random_; | 159 base::RandomNumberGenerator* const random_; |
157 uint64_t const rate_; | 160 uint64_t const rate_; |
158 }; | 161 }; |
159 | 162 |
160 } // namespace internal | 163 } // namespace internal |
161 } // namespace v8 | 164 } // namespace v8 |
162 | 165 |
163 #endif // V8_PROFILER_SAMPLING_HEAP_PROFILER_H_ | 166 #endif // V8_PROFILER_SAMPLING_HEAP_PROFILER_H_ |
OLD | NEW |