| OLD | NEW |
| 1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 the V8 project authors. All rights reserved. |
| 2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
| 3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
| 4 // met: | 4 // met: |
| 5 // | 5 // |
| 6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
| 7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
| 8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
| 9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
| 10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
| (...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 192 | 192 |
| 193 DISALLOW_COPY_AND_ASSIGN(ProfileTree); | 193 DISALLOW_COPY_AND_ASSIGN(ProfileTree); |
| 194 }; | 194 }; |
| 195 | 195 |
| 196 | 196 |
| 197 class CpuProfile { | 197 class CpuProfile { |
| 198 public: | 198 public: |
| 199 CpuProfile(const char* title, bool record_samples); | 199 CpuProfile(const char* title, bool record_samples); |
| 200 | 200 |
| 201 // Add pc -> ... -> main() call path to the profile. | 201 // Add pc -> ... -> main() call path to the profile. |
| 202 void AddPath(const Vector<CodeEntry*>& path); | 202 void AddPath(TimeTicks timestamp, const Vector<CodeEntry*>& path); |
| 203 void CalculateTotalTicksAndSamplingRate(); | 203 void CalculateTotalTicksAndSamplingRate(); |
| 204 | 204 |
| 205 const char* title() const { return title_; } | 205 const char* title() const { return title_; } |
| 206 const ProfileTree* top_down() const { return &top_down_; } | 206 const ProfileTree* top_down() const { return &top_down_; } |
| 207 | 207 |
| 208 int samples_count() const { return samples_.length(); } | 208 int samples_count() const { return samples_.length(); } |
| 209 ProfileNode* sample(int index) const { return samples_.at(index); } | 209 ProfileNode* sample(int index) const { return samples_.at(index); } |
| 210 TimeTicks sample_timestamp(int index) const { return timestamps_.at(index); } |
| 210 | 211 |
| 211 TimeTicks start_time() const { return start_time_; } | 212 TimeTicks start_time() const { return start_time_; } |
| 212 TimeTicks end_time() const { return end_time_; } | 213 TimeTicks end_time() const { return end_time_; } |
| 213 | 214 |
| 214 void UpdateTicksScale(); | 215 void UpdateTicksScale(); |
| 215 | 216 |
| 216 void Print(); | 217 void Print(); |
| 217 | 218 |
| 218 private: | 219 private: |
| 219 const char* title_; | 220 const char* title_; |
| 220 bool record_samples_; | 221 bool record_samples_; |
| 221 TimeTicks start_time_; | 222 TimeTicks start_time_; |
| 222 TimeTicks end_time_; | 223 TimeTicks end_time_; |
| 223 List<ProfileNode*> samples_; | 224 List<ProfileNode*> samples_; |
| 225 List<TimeTicks> timestamps_; |
| 224 ProfileTree top_down_; | 226 ProfileTree top_down_; |
| 225 | 227 |
| 226 DISALLOW_COPY_AND_ASSIGN(CpuProfile); | 228 DISALLOW_COPY_AND_ASSIGN(CpuProfile); |
| 227 }; | 229 }; |
| 228 | 230 |
| 229 | 231 |
| 230 class CodeMap { | 232 class CodeMap { |
| 231 public: | 233 public: |
| 232 CodeMap() : next_shared_id_(1) { } | 234 CodeMap() : next_shared_id_(1) { } |
| 233 void AddCode(Address addr, CodeEntry* entry, unsigned size); | 235 void AddCode(Address addr, CodeEntry* entry, unsigned size); |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 298 | 300 |
| 299 CodeEntry* NewCodeEntry( | 301 CodeEntry* NewCodeEntry( |
| 300 Logger::LogEventsAndTags tag, | 302 Logger::LogEventsAndTags tag, |
| 301 const char* name, | 303 const char* name, |
| 302 const char* name_prefix = CodeEntry::kEmptyNamePrefix, | 304 const char* name_prefix = CodeEntry::kEmptyNamePrefix, |
| 303 const char* resource_name = CodeEntry::kEmptyResourceName, | 305 const char* resource_name = CodeEntry::kEmptyResourceName, |
| 304 int line_number = v8::CpuProfileNode::kNoLineNumberInfo, | 306 int line_number = v8::CpuProfileNode::kNoLineNumberInfo, |
| 305 int column_number = v8::CpuProfileNode::kNoColumnNumberInfo); | 307 int column_number = v8::CpuProfileNode::kNoColumnNumberInfo); |
| 306 | 308 |
| 307 // Called from profile generator thread. | 309 // Called from profile generator thread. |
| 308 void AddPathToCurrentProfiles(const Vector<CodeEntry*>& path); | 310 void AddPathToCurrentProfiles( |
| 311 TimeTicks timestamp, const Vector<CodeEntry*>& path); |
| 309 | 312 |
| 310 // Limits the number of profiles that can be simultaneously collected. | 313 // Limits the number of profiles that can be simultaneously collected. |
| 311 static const int kMaxSimultaneousProfiles = 100; | 314 static const int kMaxSimultaneousProfiles = 100; |
| 312 | 315 |
| 313 private: | 316 private: |
| 314 StringsStorage function_and_resource_names_; | 317 StringsStorage function_and_resource_names_; |
| 315 List<CodeEntry*> code_entries_; | 318 List<CodeEntry*> code_entries_; |
| 316 List<CpuProfile*> finished_profiles_; | 319 List<CpuProfile*> finished_profiles_; |
| 317 | 320 |
| 318 // Accessed by VM thread and profile generator thread. | 321 // Accessed by VM thread and profile generator thread. |
| (...skipping 30 matching lines...) Expand all Loading... |
| 349 CodeEntry* gc_entry_; | 352 CodeEntry* gc_entry_; |
| 350 CodeEntry* unresolved_entry_; | 353 CodeEntry* unresolved_entry_; |
| 351 | 354 |
| 352 DISALLOW_COPY_AND_ASSIGN(ProfileGenerator); | 355 DISALLOW_COPY_AND_ASSIGN(ProfileGenerator); |
| 353 }; | 356 }; |
| 354 | 357 |
| 355 | 358 |
| 356 } } // namespace v8::internal | 359 } } // namespace v8::internal |
| 357 | 360 |
| 358 #endif // V8_PROFILE_GENERATOR_H_ | 361 #endif // V8_PROFILE_GENERATOR_H_ |
| OLD | NEW |