OLD | NEW |
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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_PROFILE_GENERATOR_H_ | 5 #ifndef V8_PROFILER_PROFILE_GENERATOR_H_ |
6 #define V8_PROFILER_PROFILE_GENERATOR_H_ | 6 #define V8_PROFILER_PROFILE_GENERATOR_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include "include/v8-profiler.h" | 9 #include "include/v8-profiler.h" |
10 #include "src/allocation.h" | 10 #include "src/allocation.h" |
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
185 }; | 185 }; |
186 | 186 |
187 | 187 |
188 class ProfileTree { | 188 class ProfileTree { |
189 public: | 189 public: |
190 explicit ProfileTree(Isolate* isolate); | 190 explicit ProfileTree(Isolate* isolate); |
191 ~ProfileTree(); | 191 ~ProfileTree(); |
192 | 192 |
193 ProfileNode* AddPathFromEnd( | 193 ProfileNode* AddPathFromEnd( |
194 const Vector<CodeEntry*>& path, | 194 const Vector<CodeEntry*>& path, |
195 int src_line = v8::CpuProfileNode::kNoLineNumberInfo); | 195 int src_line = v8::CpuProfileNode::kNoLineNumberInfo, |
| 196 bool update_stats = true); |
196 ProfileNode* root() const { return root_; } | 197 ProfileNode* root() const { return root_; } |
197 unsigned next_node_id() { return next_node_id_++; } | 198 unsigned next_node_id() { return next_node_id_++; } |
198 unsigned GetFunctionId(const ProfileNode* node); | 199 unsigned GetFunctionId(const ProfileNode* node); |
199 | 200 |
200 void Print() { | 201 void Print() { |
201 root_->Print(0); | 202 root_->Print(0); |
202 } | 203 } |
203 | 204 |
204 Isolate* isolate() const { return isolate_; } | 205 Isolate* isolate() const { return isolate_; } |
205 | 206 |
(...skipping 12 matching lines...) Expand all Loading... |
218 DISALLOW_COPY_AND_ASSIGN(ProfileTree); | 219 DISALLOW_COPY_AND_ASSIGN(ProfileTree); |
219 }; | 220 }; |
220 | 221 |
221 | 222 |
222 class CpuProfile { | 223 class CpuProfile { |
223 public: | 224 public: |
224 CpuProfile(Isolate* isolate, const char* title, bool record_samples); | 225 CpuProfile(Isolate* isolate, const char* title, bool record_samples); |
225 | 226 |
226 // Add pc -> ... -> main() call path to the profile. | 227 // Add pc -> ... -> main() call path to the profile. |
227 void AddPath(base::TimeTicks timestamp, const Vector<CodeEntry*>& path, | 228 void AddPath(base::TimeTicks timestamp, const Vector<CodeEntry*>& path, |
228 int src_line); | 229 int src_line, bool update_stats); |
229 void CalculateTotalTicksAndSamplingRate(); | 230 void CalculateTotalTicksAndSamplingRate(); |
230 | 231 |
231 const char* title() const { return title_; } | 232 const char* title() const { return title_; } |
232 const ProfileTree* top_down() const { return &top_down_; } | 233 const ProfileTree* top_down() const { return &top_down_; } |
233 | 234 |
234 int samples_count() const { return samples_.length(); } | 235 int samples_count() const { return samples_.length(); } |
235 ProfileNode* sample(int index) const { return samples_.at(index); } | 236 ProfileNode* sample(int index) const { return samples_.at(index); } |
236 base::TimeTicks sample_timestamp(int index) const { | 237 base::TimeTicks sample_timestamp(int index) const { |
237 return timestamps_.at(index); | 238 return timestamps_.at(index); |
238 } | 239 } |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
326 CodeEntry* NewCodeEntry( | 327 CodeEntry* NewCodeEntry( |
327 Logger::LogEventsAndTags tag, const char* name, | 328 Logger::LogEventsAndTags tag, const char* name, |
328 const char* name_prefix = CodeEntry::kEmptyNamePrefix, | 329 const char* name_prefix = CodeEntry::kEmptyNamePrefix, |
329 const char* resource_name = CodeEntry::kEmptyResourceName, | 330 const char* resource_name = CodeEntry::kEmptyResourceName, |
330 int line_number = v8::CpuProfileNode::kNoLineNumberInfo, | 331 int line_number = v8::CpuProfileNode::kNoLineNumberInfo, |
331 int column_number = v8::CpuProfileNode::kNoColumnNumberInfo, | 332 int column_number = v8::CpuProfileNode::kNoColumnNumberInfo, |
332 JITLineInfoTable* line_info = NULL, Address instruction_start = NULL); | 333 JITLineInfoTable* line_info = NULL, Address instruction_start = NULL); |
333 | 334 |
334 // Called from profile generator thread. | 335 // Called from profile generator thread. |
335 void AddPathToCurrentProfiles(base::TimeTicks timestamp, | 336 void AddPathToCurrentProfiles(base::TimeTicks timestamp, |
336 const Vector<CodeEntry*>& path, int src_line); | 337 const Vector<CodeEntry*>& path, int src_line, |
| 338 bool update_stats); |
337 | 339 |
338 // Limits the number of profiles that can be simultaneously collected. | 340 // Limits the number of profiles that can be simultaneously collected. |
339 static const int kMaxSimultaneousProfiles = 100; | 341 static const int kMaxSimultaneousProfiles = 100; |
340 | 342 |
341 private: | 343 private: |
342 StringsStorage function_and_resource_names_; | 344 StringsStorage function_and_resource_names_; |
343 List<CodeEntry*> code_entries_; | 345 List<CodeEntry*> code_entries_; |
344 List<CpuProfile*> finished_profiles_; | 346 List<CpuProfile*> finished_profiles_; |
345 | 347 |
346 Isolate* isolate_; | 348 Isolate* isolate_; |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
379 CodeEntry* unresolved_entry_; | 381 CodeEntry* unresolved_entry_; |
380 | 382 |
381 DISALLOW_COPY_AND_ASSIGN(ProfileGenerator); | 383 DISALLOW_COPY_AND_ASSIGN(ProfileGenerator); |
382 }; | 384 }; |
383 | 385 |
384 | 386 |
385 } // namespace internal | 387 } // namespace internal |
386 } // namespace v8 | 388 } // namespace v8 |
387 | 389 |
388 #endif // V8_PROFILER_PROFILE_GENERATOR_H_ | 390 #endif // V8_PROFILER_PROFILE_GENERATOR_H_ |
OLD | NEW |