Chromium Code Reviews| 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 245 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 256 bool record_samples_; | 256 bool record_samples_; |
| 257 base::TimeTicks start_time_; | 257 base::TimeTicks start_time_; |
| 258 base::TimeTicks end_time_; | 258 base::TimeTicks end_time_; |
| 259 List<ProfileNode*> samples_; | 259 List<ProfileNode*> samples_; |
| 260 List<base::TimeTicks> timestamps_; | 260 List<base::TimeTicks> timestamps_; |
| 261 ProfileTree top_down_; | 261 ProfileTree top_down_; |
| 262 | 262 |
| 263 DISALLOW_COPY_AND_ASSIGN(CpuProfile); | 263 DISALLOW_COPY_AND_ASSIGN(CpuProfile); |
| 264 }; | 264 }; |
| 265 | 265 |
| 266 | |
| 267 class CodeMap { | 266 class CodeMap { |
| 268 public: | 267 public: |
| 269 CodeMap() {} | 268 CodeMap() {} |
| 270 ~CodeMap(); | 269 |
|
jochen (gone - plz use gerrit)
2016/06/08 15:01:40
why no dtor?
alph
2016/06/08 21:48:11
Why would I need one? The CodeMap has the only ins
| |
| 271 void AddCode(Address addr, CodeEntry* entry, unsigned size); | 270 void AddCode(Address addr, CodeEntry* entry, unsigned size); |
| 272 void MoveCode(Address from, Address to); | 271 void MoveCode(Address from, Address to); |
| 273 CodeEntry* FindEntry(Address addr); | 272 CodeEntry* FindEntry(Address addr); |
| 274 int GetSharedId(Address addr); | |
| 275 | |
| 276 void Print(); | 273 void Print(); |
| 277 | 274 |
| 278 private: | 275 private: |
| 279 struct CodeEntryInfo { | 276 struct CodeEntryInfo { |
| 280 CodeEntryInfo(CodeEntry* an_entry, unsigned a_size) | 277 CodeEntryInfo(CodeEntry* an_entry, unsigned a_size) |
| 281 : entry(an_entry), size(a_size) { } | 278 : entry(an_entry), size(a_size) { } |
| 282 CodeEntry* entry; | 279 CodeEntry* entry; |
| 283 unsigned size; | 280 unsigned size; |
| 284 }; | 281 }; |
| 285 | 282 |
| 286 struct CodeTreeConfig { | |
| 287 typedef Address Key; | |
| 288 typedef CodeEntryInfo Value; | |
| 289 static const Key kNoKey; | |
| 290 static const Value NoValue() { return CodeEntryInfo(NULL, 0); } | |
| 291 static int Compare(const Key& a, const Key& b) { | |
| 292 return a < b ? -1 : (a > b ? 1 : 0); | |
| 293 } | |
| 294 }; | |
| 295 typedef SplayTree<CodeTreeConfig> CodeTree; | |
| 296 | |
| 297 class CodeTreePrinter { | |
| 298 public: | |
| 299 void Call(const Address& key, const CodeEntryInfo& value); | |
| 300 }; | |
| 301 | |
| 302 void DeleteAllCoveredCode(Address start, Address end); | 283 void DeleteAllCoveredCode(Address start, Address end); |
| 303 | 284 |
| 304 CodeTree tree_; | 285 std::map<Address, CodeEntryInfo> code_map_; |
| 305 | 286 |
| 306 DISALLOW_COPY_AND_ASSIGN(CodeMap); | 287 DISALLOW_COPY_AND_ASSIGN(CodeMap); |
| 307 }; | 288 }; |
| 308 | 289 |
| 309 | |
| 310 class CpuProfilesCollection { | 290 class CpuProfilesCollection { |
| 311 public: | 291 public: |
| 312 explicit CpuProfilesCollection(Heap* heap); | 292 explicit CpuProfilesCollection(Heap* heap); |
| 313 ~CpuProfilesCollection(); | 293 ~CpuProfilesCollection(); |
| 314 | 294 |
| 315 bool StartProfiling(const char* title, bool record_samples); | 295 bool StartProfiling(const char* title, bool record_samples); |
| 316 CpuProfile* StopProfiling(const char* title); | 296 CpuProfile* StopProfiling(const char* title); |
| 317 List<CpuProfile*>* profiles() { return &finished_profiles_; } | 297 List<CpuProfile*>* profiles() { return &finished_profiles_; } |
| 318 const char* GetName(Name* name) { | 298 const char* GetName(Name* name) { |
| 319 return function_and_resource_names_.GetName(name); | 299 return function_and_resource_names_.GetName(name); |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 387 CodeEntry* unresolved_entry_; | 367 CodeEntry* unresolved_entry_; |
| 388 | 368 |
| 389 DISALLOW_COPY_AND_ASSIGN(ProfileGenerator); | 369 DISALLOW_COPY_AND_ASSIGN(ProfileGenerator); |
| 390 }; | 370 }; |
| 391 | 371 |
| 392 | 372 |
| 393 } // namespace internal | 373 } // namespace internal |
| 394 } // namespace v8 | 374 } // namespace v8 |
| 395 | 375 |
| 396 #endif // V8_PROFILER_PROFILE_GENERATOR_H_ | 376 #endif // V8_PROFILER_PROFILE_GENERATOR_H_ |
| OLD | NEW |