| OLD | NEW |
| 1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, 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 #include "vm/profiler_service.h" | 5 #include "vm/profiler_service.h" |
| 6 | 6 |
| 7 #include "vm/growable_array.h" | 7 #include "vm/growable_array.h" |
| 8 #include "vm/handles_impl.h" | 8 #include "vm/handles_impl.h" |
| 9 #include "vm/hash_map.h" | 9 #include "vm/hash_map.h" |
| 10 #include "vm/log.h" | 10 #include "vm/log.h" |
| (...skipping 798 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 809 } | 809 } |
| 810 code = At(hi); | 810 code = At(hi); |
| 811 if (code->Overlaps(new_code)) { | 811 if (code->Overlaps(new_code)) { |
| 812 HandleOverlap(code, new_code, start, end); | 812 HandleOverlap(code, new_code, start, end); |
| 813 return hi; | 813 return hi; |
| 814 } | 814 } |
| 815 table_.InsertAt(hi, new_code); | 815 table_.InsertAt(hi, new_code); |
| 816 return hi; | 816 return hi; |
| 817 } | 817 } |
| 818 UNREACHABLE(); | 818 UNREACHABLE(); |
| 819 return -1; |
| 819 } | 820 } |
| 820 | 821 |
| 821 private: | 822 private: |
| 822 intptr_t FindCodeIndex(uword pc, RangeCompare comparator) const { | 823 intptr_t FindCodeIndex(uword pc, RangeCompare comparator) const { |
| 823 ASSERT(comparator != NULL); | 824 ASSERT(comparator != NULL); |
| 824 intptr_t count = table_.length(); | 825 intptr_t count = table_.length(); |
| 825 intptr_t first = 0; | 826 intptr_t first = 0; |
| 826 while (count > 0) { | 827 while (count > 0) { |
| 827 intptr_t it = first; | 828 intptr_t it = first; |
| 828 intptr_t step = count / 2; | 829 intptr_t step = count / 2; |
| (...skipping 1804 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2633 return NULL; | 2634 return NULL; |
| 2634 } | 2635 } |
| 2635 if (code_trie_) { | 2636 if (code_trie_) { |
| 2636 ProfileCode* code = profile_->GetCode(current_->table_index()); | 2637 ProfileCode* code = profile_->GetCode(current_->table_index()); |
| 2637 return code->name(); | 2638 return code->name(); |
| 2638 } else { | 2639 } else { |
| 2639 ProfileFunction* func = profile_->GetFunction(current_->table_index()); | 2640 ProfileFunction* func = profile_->GetFunction(current_->table_index()); |
| 2640 return func->Name(); | 2641 return func->Name(); |
| 2641 } | 2642 } |
| 2642 UNREACHABLE(); | 2643 UNREACHABLE(); |
| 2644 return NULL; |
| 2643 } | 2645 } |
| 2644 | 2646 |
| 2645 | 2647 |
| 2646 intptr_t ProfileTrieWalker::CurrentNodeTickCount() { | 2648 intptr_t ProfileTrieWalker::CurrentNodeTickCount() { |
| 2647 if (current_ == NULL) { | 2649 if (current_ == NULL) { |
| 2648 return -1; | 2650 return -1; |
| 2649 } | 2651 } |
| 2650 return current_->count(); | 2652 return current_->count(); |
| 2651 } | 2653 } |
| 2652 | 2654 |
| 2653 | 2655 |
| 2654 intptr_t ProfileTrieWalker::CurrentInclusiveTicks() { | 2656 intptr_t ProfileTrieWalker::CurrentInclusiveTicks() { |
| 2655 if (current_ == NULL) { | 2657 if (current_ == NULL) { |
| 2656 return -1; | 2658 return -1; |
| 2657 } | 2659 } |
| 2658 if (code_trie_) { | 2660 if (code_trie_) { |
| 2659 ProfileCode* code = profile_->GetCode(current_->table_index()); | 2661 ProfileCode* code = profile_->GetCode(current_->table_index()); |
| 2660 return code->inclusive_ticks(); | 2662 return code->inclusive_ticks(); |
| 2661 } else { | 2663 } else { |
| 2662 ProfileFunction* func = profile_->GetFunction(current_->table_index()); | 2664 ProfileFunction* func = profile_->GetFunction(current_->table_index()); |
| 2663 return func->inclusive_ticks(); | 2665 return func->inclusive_ticks(); |
| 2664 } | 2666 } |
| 2665 UNREACHABLE(); | 2667 UNREACHABLE(); |
| 2668 return -1; |
| 2666 } | 2669 } |
| 2667 | 2670 |
| 2668 | 2671 |
| 2669 intptr_t ProfileTrieWalker::CurrentExclusiveTicks() { | 2672 intptr_t ProfileTrieWalker::CurrentExclusiveTicks() { |
| 2670 if (current_ == NULL) { | 2673 if (current_ == NULL) { |
| 2671 return -1; | 2674 return -1; |
| 2672 } | 2675 } |
| 2673 if (code_trie_) { | 2676 if (code_trie_) { |
| 2674 ProfileCode* code = profile_->GetCode(current_->table_index()); | 2677 ProfileCode* code = profile_->GetCode(current_->table_index()); |
| 2675 return code->exclusive_ticks(); | 2678 return code->exclusive_ticks(); |
| 2676 } else { | 2679 } else { |
| 2677 ProfileFunction* func = profile_->GetFunction(current_->table_index()); | 2680 ProfileFunction* func = profile_->GetFunction(current_->table_index()); |
| 2678 return func->exclusive_ticks(); | 2681 return func->exclusive_ticks(); |
| 2679 } | 2682 } |
| 2680 UNREACHABLE(); | 2683 UNREACHABLE(); |
| 2684 return -1; |
| 2681 } | 2685 } |
| 2682 | 2686 |
| 2683 | 2687 |
| 2684 const char* ProfileTrieWalker::CurrentToken() { | 2688 const char* ProfileTrieWalker::CurrentToken() { |
| 2685 if (current_ == NULL) { | 2689 if (current_ == NULL) { |
| 2686 return NULL; | 2690 return NULL; |
| 2687 } | 2691 } |
| 2688 if (code_trie_) { | 2692 if (code_trie_) { |
| 2689 return NULL; | 2693 return NULL; |
| 2690 } | 2694 } |
| (...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2896 // Disable thread interrupts while processing the buffer. | 2900 // Disable thread interrupts while processing the buffer. |
| 2897 DisableThreadInterruptsScope dtis(thread); | 2901 DisableThreadInterruptsScope dtis(thread); |
| 2898 | 2902 |
| 2899 ClearProfileVisitor clear_profile(isolate); | 2903 ClearProfileVisitor clear_profile(isolate); |
| 2900 sample_buffer->VisitSamples(&clear_profile); | 2904 sample_buffer->VisitSamples(&clear_profile); |
| 2901 } | 2905 } |
| 2902 | 2906 |
| 2903 #endif // !PRODUCT | 2907 #endif // !PRODUCT |
| 2904 | 2908 |
| 2905 } // namespace dart | 2909 } // namespace dart |
| OLD | NEW |