From b2bdbfdc1e13bc981ad39c4770bc39b30a2e1af5 Mon Sep 17 00:00:00 2001 From: John McCutchan Date: Tue, 28 Jul 2015 15:18:29 -0700 Subject: [PATCH] Fix bad inclusive ticks for functions on release x64 BUG= Review URL: https://codereview.chromium.org//1264523002 . --- runtime/vm/profiler_service.cc | 5 ++++- runtime/vm/profiler_test.cc | 4 ++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/runtime/vm/profiler_service.cc b/runtime/vm/profiler_service.cc index b251455aa95..376da1aee95 100644 --- a/runtime/vm/profiler_service.cc +++ b/runtime/vm/profiler_service.cc @@ -97,7 +97,8 @@ ProfileFunction::ProfileFunction(Kind kind, table_index_(table_index), profile_codes_(0), exclusive_ticks_(0), - inclusive_ticks_(0) { + inclusive_ticks_(0), + inclusive_serial_(-1) { ASSERT((kind_ != kDartFunction) || !function_.IsNull()); ASSERT((kind_ != kDartFunction) || (table_index_ >= 0)); ASSERT(profile_codes_.length() == 0); @@ -1224,6 +1225,7 @@ class ProfileBuilder : public ValueObject { void BuildInclusiveFunctionTrie(ProfileFunctionTrieNode* root) { ScopeTimer sw("ProfileBuilder::BuildInclusiveFunctionTrie", FLAG_trace_profiler); + ASSERT(!tick_functions_); for (intptr_t sample_index = 0; sample_index < samples_->length(); sample_index++) { @@ -1254,6 +1256,7 @@ class ProfileBuilder : public ValueObject { void BuildExclusiveFunctionTrie(ProfileFunctionTrieNode* root) { ScopeTimer sw("ProfileBuilder::BuildExclusiveFunctionTrie", FLAG_trace_profiler); + ASSERT(tick_functions_); for (intptr_t sample_index = 0; sample_index < samples_->length(); sample_index++) { diff --git a/runtime/vm/profiler_test.cc b/runtime/vm/profiler_test.cc index 9b6cfaf4fa6..2ef65e91059 100644 --- a/runtime/vm/profiler_test.cc +++ b/runtime/vm/profiler_test.cc @@ -369,7 +369,7 @@ TEST_CASE(Profiler_CodeTicks) { Profile profile(isolate); AllocationFilter filter(isolate, class_a.id()); profile.Build(&filter, Profile::kNoTags); - // We should have one allocation sample. + // We should have three allocation samples. EXPECT_EQ(3, profile.sample_count()); ProfileTrieWalker walker(&profile); @@ -461,7 +461,7 @@ TEST_CASE(Profiler_FunctionTicks) { Profile profile(isolate); AllocationFilter filter(isolate, class_a.id()); profile.Build(&filter, Profile::kNoTags); - // We should have one allocation sample. + // We should have three allocation samples. EXPECT_EQ(3, profile.sample_count()); ProfileTrieWalker walker(&profile);