Chromium Code Reviews| Index: runtime/vm/profiler_service.cc |
| diff --git a/runtime/vm/profiler_service.cc b/runtime/vm/profiler_service.cc |
| index 583dc7783e07dc34be38a16b0d35e2ecbb64dd63..8c2e8c751f75d380ba8743498bd01c13a7f8a07f 100644 |
| --- a/runtime/vm/profiler_service.cc |
| +++ b/runtime/vm/profiler_service.cc |
| @@ -104,6 +104,15 @@ ProfileFunction::ProfileFunction(Kind kind, |
| } |
| +const char* ProfileFunction::Name() const { |
| + if (name_ != NULL) { |
| + return name_; |
| + } |
| + ASSERT(!function_.IsNull()); |
| + const String& func_name = String::Handle(function_.UserVisibleName()); |
|
rmacnak
2015/06/26 17:55:57
QualifiedUserVisibleName
Cutch
2015/06/26 18:02:49
Done.
|
| + return func_name.ToCString(); |
| +} |
| + |
| void ProfileFunction::Tick(bool exclusive, intptr_t inclusive_serial) { |
| if (exclusive) { |
| exclusive_ticks_++; |
| @@ -779,6 +788,16 @@ void ProfileTrieNode::SortChildren() { |
| } |
| +intptr_t ProfileTrieNode::IndexOf(ProfileTrieNode* node) { |
| + for (intptr_t i = 0; i < children_.length(); i++) { |
| + if (children_[i] == node) { |
| + return i; |
| + } |
| + } |
| + return -1; |
| +} |
| + |
| + |
| class ProfileCodeTrieNode : public ProfileTrieNode { |
| public: |
| explicit ProfileCodeTrieNode(intptr_t table_index) |
| @@ -1900,6 +1919,56 @@ void Profile::PrintJSON(JSONStream* stream) { |
| } |
| +void ProfileTrieWalker::Reset(Profile::TrieKind trie_kind) { |
| + code_trie_ = Profile::IsCodeTrie(trie_kind); |
| + parent_ = NULL; |
| + current_ = profile_->GetTrieRoot(trie_kind); |
| + ASSERT(current_ != NULL); |
| +} |
| + |
| + |
| +const char* ProfileTrieWalker::CurrentName() { |
| + if (current_ == NULL) { |
| + return NULL; |
| + } |
| + if (code_trie_) { |
| + ProfileCode* code = profile_->GetCode(current_->table_index()); |
| + return code->name(); |
| + } else { |
| + ProfileFunction* func = profile_->GetFunction(current_->table_index()); |
| + return func->Name(); |
| + } |
| + UNREACHABLE(); |
| +} |
| + |
| + |
| +bool ProfileTrieWalker::Down() { |
| + if ((current_ == NULL) || (current_->NumChildren() == 0)) { |
| + return false; |
| + } |
| + parent_ = current_; |
| + current_ = current_->At(0); |
| + return true; |
| +} |
| + |
| + |
| +bool ProfileTrieWalker::NextSibling() { |
| + if (parent_ == NULL) { |
| + return false; |
| + } |
| + intptr_t current_index = parent_->IndexOf(current_); |
| + if (current_index < 0) { |
| + return false; |
| + } |
| + current_index++; |
| + if (current_index >= parent_->NumChildren()) { |
| + return false; |
| + } |
| + current_ = parent_->At(current_index); |
| + return true; |
| +} |
| + |
| + |
| class NoAllocationSampleFilter : public SampleFilter { |
| public: |
| explicit NoAllocationSampleFilter(Isolate* isolate) |