Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1062)

Unified Diff: runtime/vm/profiler_service.cc

Issue 1210283003: Extend allocation profile testing (Closed) Base URL: git@github.com:dart-lang/sdk.git@profile_model_public
Patch Set: Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « runtime/vm/profiler_service.h ('k') | runtime/vm/profiler_test.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/profiler_service.cc
diff --git a/runtime/vm/profiler_service.cc b/runtime/vm/profiler_service.cc
index a75f8a20f41799c9c68c1ef545a95b202305318d..5e8940a5b9262497da510752ccf91136b9dba599 100644
--- a/runtime/vm/profiler_service.cc
+++ b/runtime/vm/profiler_service.cc
@@ -104,6 +104,16 @@ ProfileFunction::ProfileFunction(Kind kind,
}
+const char* ProfileFunction::Name() const {
+ if (name_ != NULL) {
+ return name_;
+ }
+ ASSERT(!function_.IsNull());
+ const String& func_name =
+ String::Handle(function_.QualifiedUserVisibleName());
+ return func_name.ToCString();
+}
+
void ProfileFunction::Tick(bool exclusive, intptr_t inclusive_serial) {
if (exclusive) {
exclusive_ticks_++;
@@ -779,6 +789,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)
@@ -1894,6 +1914,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)
« no previous file with comments | « runtime/vm/profiler_service.h ('k') | runtime/vm/profiler_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698