| OLD | NEW |
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef VM_PROFILER_H_ | 5 #ifndef VM_PROFILER_H_ |
| 6 #define VM_PROFILER_H_ | 6 #define VM_PROFILER_H_ |
| 7 | 7 |
| 8 #include "vm/allocation.h" | 8 #include "vm/allocation.h" |
| 9 #include "vm/bitfield.h" | 9 #include "vm/bitfield.h" |
| 10 #include "vm/code_observers.h" | 10 #include "vm/code_observers.h" |
| (...skipping 405 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 416 | 416 |
| 417 DISALLOW_COPY_AND_ASSIGN(Sample); | 417 DISALLOW_COPY_AND_ASSIGN(Sample); |
| 418 }; | 418 }; |
| 419 | 419 |
| 420 | 420 |
| 421 // A Code object descriptor. | 421 // A Code object descriptor. |
| 422 class CodeDescriptor : public ZoneAllocated { | 422 class CodeDescriptor : public ZoneAllocated { |
| 423 public: | 423 public: |
| 424 explicit CodeDescriptor(const Code& code); | 424 explicit CodeDescriptor(const Code& code); |
| 425 | 425 |
| 426 uword Entry() const; | 426 uword Start() const; |
| 427 | 427 |
| 428 uword Size() const; | 428 uword Size() const; |
| 429 | 429 |
| 430 int64_t CompileTimestamp() const; | 430 int64_t CompileTimestamp() const; |
| 431 | 431 |
| 432 RawCode* code() const { | 432 RawCode* code() const { |
| 433 return code_.raw(); | 433 return code_.raw(); |
| 434 } | 434 } |
| 435 | 435 |
| 436 const char* Name() const { | 436 const char* Name() const { |
| 437 const String& name = String::Handle(code_.Name()); | 437 const String& name = String::Handle(code_.Name()); |
| 438 return name.ToCString(); | 438 return name.ToCString(); |
| 439 } | 439 } |
| 440 | 440 |
| 441 bool Contains(uword pc) const { | 441 bool Contains(uword pc) const { |
| 442 uword end = Entry() + Size(); | 442 uword end = Start() + Size(); |
| 443 return (pc >= Entry()) && (pc < end); | 443 return (pc >= Start()) && (pc < end); |
| 444 } | 444 } |
| 445 | 445 |
| 446 static int Compare(CodeDescriptor* const* a, | 446 static int Compare(CodeDescriptor* const* a, |
| 447 CodeDescriptor* const* b) { | 447 CodeDescriptor* const* b) { |
| 448 ASSERT(a != NULL); | 448 ASSERT(a != NULL); |
| 449 ASSERT(b != NULL); | 449 ASSERT(b != NULL); |
| 450 | 450 |
| 451 uword a_entry = (*a)->Entry(); | 451 uword a_start = (*a)->Start(); |
| 452 uword b_entry = (*b)->Entry(); | 452 uword b_start = (*b)->Start(); |
| 453 | 453 |
| 454 if (a_entry < b_entry) { | 454 if (a_start < b_start) { |
| 455 return -1; | 455 return -1; |
| 456 } else if (a_entry > b_entry) { | 456 } else if (a_start > b_start) { |
| 457 return 1; | 457 return 1; |
| 458 } else { | 458 } else { |
| 459 return 0; | 459 return 0; |
| 460 } | 460 } |
| 461 } | 461 } |
| 462 | 462 |
| 463 private: | 463 private: |
| 464 const Code& code_; | 464 const Code& code_; |
| 465 | 465 |
| 466 DISALLOW_COPY_AND_ASSIGN(CodeDescriptor); | 466 DISALLOW_COPY_AND_ASSIGN(CodeDescriptor); |
| (...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 679 private: | 679 private: |
| 680 ZoneGrowableArray<ProcessedSample*> samples_; | 680 ZoneGrowableArray<ProcessedSample*> samples_; |
| 681 CodeLookupTable* code_lookup_table_; | 681 CodeLookupTable* code_lookup_table_; |
| 682 | 682 |
| 683 DISALLOW_COPY_AND_ASSIGN(ProcessedSampleBuffer); | 683 DISALLOW_COPY_AND_ASSIGN(ProcessedSampleBuffer); |
| 684 }; | 684 }; |
| 685 | 685 |
| 686 } // namespace dart | 686 } // namespace dart |
| 687 | 687 |
| 688 #endif // VM_PROFILER_H_ | 688 #endif // VM_PROFILER_H_ |
| OLD | NEW |