| Index: runtime/vm/profiler_service.cc
|
| diff --git a/runtime/vm/profiler_service.cc b/runtime/vm/profiler_service.cc
|
| index f7b877d32314c9425e926c7d15b076243d5a3691..59578b135bfc334eeb05d3ab3cbb7a3439e4f40b 100644
|
| --- a/runtime/vm/profiler_service.cc
|
| +++ b/runtime/vm/profiler_service.cc
|
| @@ -91,12 +91,10 @@ class DeoptimizedCodeSet : public ZoneAllocated {
|
| const GrowableObjectArray& current_;
|
| };
|
|
|
| -
|
| ProfileFunctionSourcePosition::ProfileFunctionSourcePosition(
|
| TokenPosition token_pos)
|
| : token_pos_(token_pos), exclusive_ticks_(0), inclusive_ticks_(0) {}
|
|
|
| -
|
| void ProfileFunctionSourcePosition::Tick(bool exclusive) {
|
| if (exclusive) {
|
| exclusive_ticks_++;
|
| @@ -105,7 +103,6 @@ void ProfileFunctionSourcePosition::Tick(bool exclusive) {
|
| }
|
| }
|
|
|
| -
|
| ProfileFunction::ProfileFunction(Kind kind,
|
| const char* name,
|
| const Function& function,
|
| @@ -124,7 +121,6 @@ ProfileFunction::ProfileFunction(Kind kind,
|
| ASSERT(profile_codes_.length() == 0);
|
| }
|
|
|
| -
|
| const char* ProfileFunction::Name() const {
|
| if (name_ != NULL) {
|
| return name_;
|
| @@ -135,7 +131,6 @@ const char* ProfileFunction::Name() const {
|
| return func_name.ToCString();
|
| }
|
|
|
| -
|
| bool ProfileFunction::is_visible() const {
|
| if (function_.IsNull()) {
|
| // Some synthetic function.
|
| @@ -144,7 +139,6 @@ bool ProfileFunction::is_visible() const {
|
| return FLAG_show_invisible_frames || function_.is_visible();
|
| }
|
|
|
| -
|
| void ProfileFunction::Tick(bool exclusive,
|
| intptr_t inclusive_serial,
|
| TokenPosition token_position) {
|
| @@ -162,7 +156,6 @@ void ProfileFunction::Tick(bool exclusive,
|
| TickSourcePosition(token_position, false);
|
| }
|
|
|
| -
|
| void ProfileFunction::TickSourcePosition(TokenPosition token_position,
|
| bool exclusive) {
|
| intptr_t i = 0;
|
| @@ -199,7 +192,6 @@ void ProfileFunction::TickSourcePosition(TokenPosition token_position,
|
| }
|
| }
|
|
|
| -
|
| const char* ProfileFunction::KindToCString(Kind kind) {
|
| switch (kind) {
|
| case kDartFunction:
|
| @@ -218,14 +210,12 @@ const char* ProfileFunction::KindToCString(Kind kind) {
|
| }
|
| }
|
|
|
| -
|
| void ProfileFunction::PrintToJSONObject(JSONObject* func) {
|
| func->AddProperty("type", "@Function");
|
| func->AddProperty("name", name());
|
| func->AddProperty("_kind", KindToCString(kind()));
|
| }
|
|
|
| -
|
| void ProfileFunction::PrintToJSONArray(JSONArray* functions) {
|
| JSONObject obj(functions);
|
| obj.AddProperty("kind", KindToCString(kind()));
|
| @@ -247,7 +237,6 @@ void ProfileFunction::PrintToJSONArray(JSONArray* functions) {
|
| }
|
| }
|
|
|
| -
|
| void ProfileFunction::AddProfileCode(intptr_t code_table_index) {
|
| for (intptr_t i = 0; i < profile_codes_.length(); i++) {
|
| if (profile_codes_[i] == code_table_index) {
|
| @@ -257,7 +246,6 @@ void ProfileFunction::AddProfileCode(intptr_t code_table_index) {
|
| profile_codes_.Add(code_table_index);
|
| }
|
|
|
| -
|
| bool ProfileFunction::GetSinglePosition(ProfileFunctionSourcePosition* pfsp) {
|
| if (pfsp == NULL) {
|
| return false;
|
| @@ -269,11 +257,9 @@ bool ProfileFunction::GetSinglePosition(ProfileFunctionSourcePosition* pfsp) {
|
| return true;
|
| }
|
|
|
| -
|
| ProfileCodeAddress::ProfileCodeAddress(uword pc)
|
| : pc_(pc), exclusive_ticks_(0), inclusive_ticks_(0) {}
|
|
|
| -
|
| void ProfileCodeAddress::Tick(bool exclusive) {
|
| if (exclusive) {
|
| exclusive_ticks_++;
|
| @@ -282,7 +268,6 @@ void ProfileCodeAddress::Tick(bool exclusive) {
|
| }
|
| }
|
|
|
| -
|
| ProfileCode::ProfileCode(Kind kind,
|
| uword start,
|
| uword end,
|
| @@ -301,7 +286,6 @@ ProfileCode::ProfileCode(Kind kind,
|
| code_table_index_(-1),
|
| address_ticks_(0) {}
|
|
|
| -
|
| void ProfileCode::TruncateLower(uword start) {
|
| if (start > start_) {
|
| start_ = start;
|
| @@ -309,7 +293,6 @@ void ProfileCode::TruncateLower(uword start) {
|
| ASSERT(start_ < end_);
|
| }
|
|
|
| -
|
| void ProfileCode::TruncateUpper(uword end) {
|
| if (end < end_) {
|
| end_ = end;
|
| @@ -317,7 +300,6 @@ void ProfileCode::TruncateUpper(uword end) {
|
| ASSERT(start_ < end_);
|
| }
|
|
|
| -
|
| void ProfileCode::ExpandLower(uword start) {
|
| if (start < start_) {
|
| start_ = start;
|
| @@ -325,7 +307,6 @@ void ProfileCode::ExpandLower(uword start) {
|
| ASSERT(start_ < end_);
|
| }
|
|
|
| -
|
| void ProfileCode::ExpandUpper(uword end) {
|
| if (end > end_) {
|
| end_ = end;
|
| @@ -333,19 +314,16 @@ void ProfileCode::ExpandUpper(uword end) {
|
| ASSERT(start_ < end_);
|
| }
|
|
|
| -
|
| bool ProfileCode::Overlaps(const ProfileCode* other) const {
|
| ASSERT(other != NULL);
|
| return other->Contains(start_) || other->Contains(end_ - 1) ||
|
| Contains(other->start()) || Contains(other->end() - 1);
|
| }
|
|
|
| -
|
| bool ProfileCode::IsOptimizedDart() const {
|
| return !code_.IsNull() && code_.is_optimized();
|
| }
|
|
|
| -
|
| void ProfileCode::SetName(const char* name) {
|
| if (name == NULL) {
|
| name_ = NULL;
|
| @@ -356,7 +334,6 @@ void ProfileCode::SetName(const char* name) {
|
| name_[len] = '\0';
|
| }
|
|
|
| -
|
| void ProfileCode::GenerateAndSetSymbolName(const char* prefix) {
|
| const intptr_t kBuffSize = 512;
|
| char buff[kBuffSize];
|
| @@ -365,7 +342,6 @@ void ProfileCode::GenerateAndSetSymbolName(const char* prefix) {
|
| SetName(buff);
|
| }
|
|
|
| -
|
| void ProfileCode::Tick(uword pc, bool exclusive, intptr_t serial) {
|
| // If exclusive is set, tick it.
|
| if (exclusive) {
|
| @@ -382,7 +358,6 @@ void ProfileCode::Tick(uword pc, bool exclusive, intptr_t serial) {
|
| TickAddress(pc, false);
|
| }
|
|
|
| -
|
| void ProfileCode::TickAddress(uword pc, bool exclusive) {
|
| const intptr_t length = address_ticks_.length();
|
|
|
| @@ -413,7 +388,6 @@ void ProfileCode::TickAddress(uword pc, bool exclusive) {
|
| }
|
| }
|
|
|
| -
|
| void ProfileCode::PrintNativeCode(JSONObject* profile_code_obj) {
|
| ASSERT(kind() == kNativeCode);
|
| JSONObject obj(profile_code_obj, "code");
|
| @@ -431,7 +405,6 @@ void ProfileCode::PrintNativeCode(JSONObject* profile_code_obj) {
|
| }
|
| }
|
|
|
| -
|
| void ProfileCode::PrintCollectedCode(JSONObject* profile_code_obj) {
|
| ASSERT(kind() == kCollectedCode);
|
| JSONObject obj(profile_code_obj, "code");
|
| @@ -449,7 +422,6 @@ void ProfileCode::PrintCollectedCode(JSONObject* profile_code_obj) {
|
| }
|
| }
|
|
|
| -
|
| void ProfileCode::PrintOverwrittenCode(JSONObject* profile_code_obj) {
|
| ASSERT(kind() == kReusedCode);
|
| JSONObject obj(profile_code_obj, "code");
|
| @@ -467,7 +439,6 @@ void ProfileCode::PrintOverwrittenCode(JSONObject* profile_code_obj) {
|
| }
|
| }
|
|
|
| -
|
| void ProfileCode::PrintTagCode(JSONObject* profile_code_obj) {
|
| ASSERT(kind() == kTagCode);
|
| JSONObject obj(profile_code_obj, "code");
|
| @@ -485,7 +456,6 @@ void ProfileCode::PrintTagCode(JSONObject* profile_code_obj) {
|
| }
|
| }
|
|
|
| -
|
| const char* ProfileCode::KindToCString(Kind kind) {
|
| switch (kind) {
|
| case kDartCode:
|
| @@ -503,7 +473,6 @@ const char* ProfileCode::KindToCString(Kind kind) {
|
| return NULL;
|
| }
|
|
|
| -
|
| void ProfileCode::PrintToJSONArray(JSONArray* codes) {
|
| JSONObject obj(codes);
|
| obj.AddProperty("kind", ProfileCode::KindToCString(kind()));
|
| @@ -533,7 +502,6 @@ void ProfileCode::PrintToJSONArray(JSONArray* codes) {
|
| }
|
| }
|
|
|
| -
|
| class ProfileFunctionTable : public ZoneAllocated {
|
| public:
|
| ProfileFunctionTable()
|
| @@ -631,7 +599,6 @@ class ProfileFunctionTable : public ZoneAllocated {
|
| DirectChainedHashMap<ProfileFunctionTableTrait> function_hash_;
|
| };
|
|
|
| -
|
| ProfileFunction* ProfileCode::SetFunctionAndName(ProfileFunctionTable* table) {
|
| ASSERT(function_ == NULL);
|
|
|
| @@ -715,7 +682,6 @@ ProfileFunction* ProfileCode::SetFunctionAndName(ProfileFunctionTable* table) {
|
| return function_;
|
| }
|
|
|
| -
|
| intptr_t ProfileCodeTable::FindCodeIndexForPC(uword pc) const {
|
| intptr_t length = table_.length();
|
| if (length == 0) {
|
| @@ -739,7 +705,6 @@ intptr_t ProfileCodeTable::FindCodeIndexForPC(uword pc) const {
|
| return -1;
|
| }
|
|
|
| -
|
| intptr_t ProfileCodeTable::InsertCode(ProfileCode* new_code) {
|
| const intptr_t length = table_.length();
|
| if (length == 0) {
|
| @@ -799,7 +764,6 @@ intptr_t ProfileCodeTable::InsertCode(ProfileCode* new_code) {
|
| return insert;
|
| }
|
|
|
| -
|
| void ProfileCodeTable::FindNeighbors(uword pc,
|
| intptr_t* lo,
|
| intptr_t* hi,
|
| @@ -848,7 +812,6 @@ void ProfileCodeTable::FindNeighbors(uword pc,
|
| }
|
| }
|
|
|
| -
|
| void ProfileCodeTable::VerifyOrder() {
|
| const intptr_t length = table_.length();
|
| if (length == 0) {
|
| @@ -874,7 +837,6 @@ void ProfileCodeTable::VerifyOverlap() {
|
| }
|
| }
|
|
|
| -
|
| ProfileTrieNode::ProfileTrieNode(intptr_t table_index)
|
| : table_index_(table_index),
|
| count_(0),
|
| @@ -885,16 +847,13 @@ ProfileTrieNode::ProfileTrieNode(intptr_t table_index)
|
| ASSERT(table_index_ >= 0);
|
| }
|
|
|
| -
|
| ProfileTrieNode::~ProfileTrieNode() {}
|
|
|
| -
|
| void ProfileTrieNode::Tick(ProcessedSample* sample, bool exclusive) {
|
| count_++;
|
| IncrementAllocation(sample->native_allocation_size_bytes(), exclusive);
|
| }
|
|
|
| -
|
| void ProfileTrieNode::SortChildren() {
|
| children_.Sort(ProfileTrieNodeCompare);
|
| // Recurse.
|
| @@ -903,7 +862,6 @@ void ProfileTrieNode::SortChildren() {
|
| }
|
| }
|
|
|
| -
|
| intptr_t ProfileTrieNode::IndexOf(ProfileTrieNode* node) {
|
| for (intptr_t i = 0; i < children_.length(); i++) {
|
| if (children_[i] == node) {
|
| @@ -913,7 +871,6 @@ intptr_t ProfileTrieNode::IndexOf(ProfileTrieNode* node) {
|
| return -1;
|
| }
|
|
|
| -
|
| class ProfileCodeTrieNode : public ProfileTrieNode {
|
| public:
|
| explicit ProfileCodeTrieNode(intptr_t table_index)
|
| @@ -964,7 +921,6 @@ class ProfileCodeTrieNode : public ProfileTrieNode {
|
| }
|
| };
|
|
|
| -
|
| class ProfileFunctionTrieNodeCode {
|
| public:
|
| explicit ProfileFunctionTrieNodeCode(intptr_t index)
|
| @@ -981,7 +937,6 @@ class ProfileFunctionTrieNodeCode {
|
| intptr_t ticks_;
|
| };
|
|
|
| -
|
| class ProfileFunctionTrieNode : public ProfileTrieNode {
|
| public:
|
| explicit ProfileFunctionTrieNode(intptr_t table_index)
|
| @@ -1057,7 +1012,6 @@ class ProfileFunctionTrieNode : public ProfileTrieNode {
|
| ZoneGrowableArray<ProfileFunctionTrieNodeCode> code_objects_;
|
| };
|
|
|
| -
|
| class ProfileCodeInlinedFunctionsCache : public ValueObject {
|
| public:
|
| ProfileCodeInlinedFunctionsCache() : cache_cursor_(0), last_hit_(0) {
|
| @@ -1202,7 +1156,6 @@ class ProfileCodeInlinedFunctionsCache : public ValueObject {
|
| intptr_t cache_hit_;
|
| };
|
|
|
| -
|
| class ProfileBuilder : public ValueObject {
|
| public:
|
| enum ProfileInfoKind {
|
| @@ -1778,7 +1731,6 @@ class ProfileBuilder : public ValueObject {
|
| function->IncInclusiveTicks();
|
| }
|
|
|
| -
|
| // Tag append functions are overloaded for |ProfileCodeTrieNode| and
|
| // |ProfileFunctionTrieNode| types.
|
|
|
| @@ -2225,7 +2177,6 @@ class ProfileBuilder : public ValueObject {
|
| thread_->isolate()->heap()->CodeContains(pc);
|
| }
|
|
|
| -
|
| ProfileCode* FindOrRegisterNativeProfileCode(uword pc) {
|
| // Check if |pc| is already known in the live code table.
|
| ProfileCodeTable* live_table = profile_->live_code_;
|
| @@ -2345,7 +2296,6 @@ class ProfileBuilder : public ValueObject {
|
| ProfileInfoKind info_kind_;
|
| }; // ProfileBuilder.
|
|
|
| -
|
| Profile::Profile(Isolate* isolate)
|
| : isolate_(isolate),
|
| zone_(Thread::Current()->zone()),
|
| @@ -2364,7 +2314,6 @@ Profile::Profile(Isolate* isolate)
|
| }
|
| }
|
|
|
| -
|
| void Profile::Build(Thread* thread,
|
| SampleFilter* filter,
|
| SampleBuffer* sample_buffer,
|
| @@ -2375,7 +2324,6 @@ void Profile::Build(Thread* thread,
|
| builder.Build();
|
| }
|
|
|
| -
|
| intptr_t Profile::NumFunctions() const {
|
| return functions_->length();
|
| }
|
| @@ -2385,7 +2333,6 @@ ProfileFunction* Profile::GetFunction(intptr_t index) {
|
| return functions_->At(index);
|
| }
|
|
|
| -
|
| ProfileCode* Profile::GetCode(intptr_t index) {
|
| ASSERT(live_code_ != NULL);
|
| ASSERT(dead_code_ != NULL);
|
| @@ -2411,12 +2358,10 @@ ProfileCode* Profile::GetCode(intptr_t index) {
|
| return tag_code_->At(index);
|
| }
|
|
|
| -
|
| ProfileTrieNode* Profile::GetTrieRoot(TrieKind trie_kind) {
|
| return roots_[static_cast<intptr_t>(trie_kind)];
|
| }
|
|
|
| -
|
| void Profile::PrintHeaderJSON(JSONObject* obj) {
|
| obj->AddProperty("samplePeriod", static_cast<intptr_t>(FLAG_profile_period));
|
| obj->AddProperty("stackDepth", static_cast<intptr_t>(FLAG_max_profile_depth));
|
| @@ -2449,7 +2394,6 @@ void Profile::PrintHeaderJSON(JSONObject* obj) {
|
| }
|
| }
|
|
|
| -
|
| void Profile::PrintTimelineFrameJSON(JSONObject* frames,
|
| ProfileTrieNode* current,
|
| ProfileTrieNode* parent,
|
| @@ -2483,7 +2427,6 @@ void Profile::PrintTimelineFrameJSON(JSONObject* frames,
|
| }
|
| }
|
|
|
| -
|
| void Profile::PrintTimelineJSON(JSONStream* stream) {
|
| ScopeTimer sw("Profile::PrintTimelineJSON", FLAG_trace_profiler);
|
| JSONObject obj(stream);
|
| @@ -2518,12 +2461,10 @@ void Profile::PrintTimelineJSON(JSONStream* stream) {
|
| }
|
| }
|
|
|
| -
|
| ProfileFunction* Profile::FindFunction(const Function& function) {
|
| return (functions_ != NULL) ? functions_->Lookup(function) : NULL;
|
| }
|
|
|
| -
|
| void Profile::PrintProfileJSON(JSONStream* stream) {
|
| ScopeTimer sw("Profile::PrintProfileJSON", FLAG_trace_profiler);
|
| JSONObject obj(stream);
|
| @@ -2582,7 +2523,6 @@ void Profile::PrintProfileJSON(JSONStream* stream) {
|
| }
|
| }
|
|
|
| -
|
| void ProfileTrieWalker::Reset(Profile::TrieKind trie_kind) {
|
| code_trie_ = Profile::IsCodeTrie(trie_kind);
|
| parent_ = NULL;
|
| @@ -2590,7 +2530,6 @@ void ProfileTrieWalker::Reset(Profile::TrieKind trie_kind) {
|
| ASSERT(current_ != NULL);
|
| }
|
|
|
| -
|
| const char* ProfileTrieWalker::CurrentName() {
|
| if (current_ == NULL) {
|
| return NULL;
|
| @@ -2606,7 +2545,6 @@ const char* ProfileTrieWalker::CurrentName() {
|
| return NULL;
|
| }
|
|
|
| -
|
| intptr_t ProfileTrieWalker::CurrentNodeTickCount() {
|
| if (current_ == NULL) {
|
| return -1;
|
| @@ -2614,7 +2552,6 @@ intptr_t ProfileTrieWalker::CurrentNodeTickCount() {
|
| return current_->count();
|
| }
|
|
|
| -
|
| intptr_t ProfileTrieWalker::CurrentInclusiveTicks() {
|
| if (current_ == NULL) {
|
| return -1;
|
| @@ -2630,7 +2567,6 @@ intptr_t ProfileTrieWalker::CurrentInclusiveTicks() {
|
| return -1;
|
| }
|
|
|
| -
|
| intptr_t ProfileTrieWalker::CurrentExclusiveTicks() {
|
| if (current_ == NULL) {
|
| return -1;
|
| @@ -2646,7 +2582,6 @@ intptr_t ProfileTrieWalker::CurrentExclusiveTicks() {
|
| return -1;
|
| }
|
|
|
| -
|
| intptr_t ProfileTrieWalker::CurrentInclusiveAllocations() {
|
| if (current_ == NULL) {
|
| return -1;
|
| @@ -2654,7 +2589,6 @@ intptr_t ProfileTrieWalker::CurrentInclusiveAllocations() {
|
| return current_->inclusive_allocations();
|
| }
|
|
|
| -
|
| intptr_t ProfileTrieWalker::CurrentExclusiveAllocations() {
|
| if (current_ == NULL) {
|
| return -1;
|
| @@ -2662,7 +2596,6 @@ intptr_t ProfileTrieWalker::CurrentExclusiveAllocations() {
|
| return current_->exclusive_allocations();
|
| }
|
|
|
| -
|
| const char* ProfileTrieWalker::CurrentToken() {
|
| if (current_ == NULL) {
|
| return NULL;
|
| @@ -2723,7 +2656,6 @@ bool ProfileTrieWalker::Down() {
|
| return true;
|
| }
|
|
|
| -
|
| bool ProfileTrieWalker::NextSibling() {
|
| if (parent_ == NULL) {
|
| return false;
|
| @@ -2740,13 +2672,11 @@ bool ProfileTrieWalker::NextSibling() {
|
| return true;
|
| }
|
|
|
| -
|
| intptr_t ProfileTrieWalker::SiblingCount() {
|
| ASSERT(parent_ != NULL);
|
| return parent_->NumChildren();
|
| }
|
|
|
| -
|
| void ProfilerService::PrintJSONImpl(Thread* thread,
|
| JSONStream* stream,
|
| Profile::TagOrder tag_order,
|
| @@ -2776,7 +2706,6 @@ void ProfilerService::PrintJSONImpl(Thread* thread,
|
| }
|
| }
|
|
|
| -
|
| class NoAllocationSampleFilter : public SampleFilter {
|
| public:
|
| NoAllocationSampleFilter(Dart_Port port,
|
| @@ -2791,7 +2720,6 @@ class NoAllocationSampleFilter : public SampleFilter {
|
| bool FilterSample(Sample* sample) { return !sample->is_allocation_sample(); }
|
| };
|
|
|
| -
|
| void ProfilerService::PrintJSON(JSONStream* stream,
|
| Profile::TagOrder tag_order,
|
| intptr_t extra_tags,
|
| @@ -2806,7 +2734,6 @@ void ProfilerService::PrintJSON(JSONStream* stream,
|
| Profiler::sample_buffer(), as_timeline);
|
| }
|
|
|
| -
|
| class ClassAllocationSampleFilter : public SampleFilter {
|
| public:
|
| ClassAllocationSampleFilter(Dart_Port port,
|
| @@ -2831,7 +2758,6 @@ class ClassAllocationSampleFilter : public SampleFilter {
|
| const Class& cls_;
|
| };
|
|
|
| -
|
| void ProfilerService::PrintAllocationJSON(JSONStream* stream,
|
| Profile::TagOrder tag_order,
|
| const Class& cls,
|
| @@ -2847,7 +2773,6 @@ void ProfilerService::PrintAllocationJSON(JSONStream* stream,
|
| Profiler::sample_buffer(), as_timeline);
|
| }
|
|
|
| -
|
| void ProfilerService::PrintNativeAllocationJSON(JSONStream* stream,
|
| Profile::TagOrder tag_order,
|
| int64_t time_origin_micros,
|
| @@ -2859,7 +2784,6 @@ void ProfilerService::PrintNativeAllocationJSON(JSONStream* stream,
|
| Profiler::allocation_sample_buffer(), as_timeline);
|
| }
|
|
|
| -
|
| void ProfilerService::PrintTimelineJSON(JSONStream* stream,
|
| Profile::TagOrder tag_order,
|
| int64_t time_origin_micros,
|
| @@ -2876,7 +2800,6 @@ void ProfilerService::PrintTimelineJSON(JSONStream* stream,
|
| Profiler::sample_buffer(), as_timeline);
|
| }
|
|
|
| -
|
| void ProfilerService::ClearSamples() {
|
| SampleBuffer* sample_buffer = Profiler::sample_buffer();
|
| if (sample_buffer == NULL) {
|
|
|