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/native_symbol.h" | 8 #include "vm/native_symbol.h" |
9 #include "vm/object.h" | 9 #include "vm/object.h" |
10 #include "vm/os.h" | 10 #include "vm/os.h" |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
90 ProfileFunction::ProfileFunction(Kind kind, | 90 ProfileFunction::ProfileFunction(Kind kind, |
91 const char* name, | 91 const char* name, |
92 const Function& function, | 92 const Function& function, |
93 const intptr_t table_index) | 93 const intptr_t table_index) |
94 : kind_(kind), | 94 : kind_(kind), |
95 name_(name), | 95 name_(name), |
96 function_(Function::ZoneHandle(function.raw())), | 96 function_(Function::ZoneHandle(function.raw())), |
97 table_index_(table_index), | 97 table_index_(table_index), |
98 profile_codes_(0), | 98 profile_codes_(0), |
99 exclusive_ticks_(0), | 99 exclusive_ticks_(0), |
100 inclusive_ticks_(0) { | 100 inclusive_ticks_(0), |
| 101 inclusive_serial_(-1) { |
101 ASSERT((kind_ != kDartFunction) || !function_.IsNull()); | 102 ASSERT((kind_ != kDartFunction) || !function_.IsNull()); |
102 ASSERT((kind_ != kDartFunction) || (table_index_ >= 0)); | 103 ASSERT((kind_ != kDartFunction) || (table_index_ >= 0)); |
103 ASSERT(profile_codes_.length() == 0); | 104 ASSERT(profile_codes_.length() == 0); |
104 } | 105 } |
105 | 106 |
106 | 107 |
107 const char* ProfileFunction::Name() const { | 108 const char* ProfileFunction::Name() const { |
108 if (name_ != NULL) { | 109 if (name_ != NULL) { |
109 return name_; | 110 return name_; |
110 } | 111 } |
(...skipping 1106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1217 } else { | 1218 } else { |
1218 BuildExclusiveFunctionTrie(root); | 1219 BuildExclusiveFunctionTrie(root); |
1219 } | 1220 } |
1220 root->SortChildren(); | 1221 root->SortChildren(); |
1221 profile_->roots_[static_cast<intptr_t>(kind)] = root; | 1222 profile_->roots_[static_cast<intptr_t>(kind)] = root; |
1222 } | 1223 } |
1223 | 1224 |
1224 void BuildInclusiveFunctionTrie(ProfileFunctionTrieNode* root) { | 1225 void BuildInclusiveFunctionTrie(ProfileFunctionTrieNode* root) { |
1225 ScopeTimer sw("ProfileBuilder::BuildInclusiveFunctionTrie", | 1226 ScopeTimer sw("ProfileBuilder::BuildInclusiveFunctionTrie", |
1226 FLAG_trace_profiler); | 1227 FLAG_trace_profiler); |
| 1228 ASSERT(!tick_functions_); |
1227 for (intptr_t sample_index = 0; | 1229 for (intptr_t sample_index = 0; |
1228 sample_index < samples_->length(); | 1230 sample_index < samples_->length(); |
1229 sample_index++) { | 1231 sample_index++) { |
1230 ProcessedSample* sample = samples_->At(sample_index); | 1232 ProcessedSample* sample = samples_->At(sample_index); |
1231 | 1233 |
1232 // Tick the root. | 1234 // Tick the root. |
1233 ProfileFunctionTrieNode* current = root; | 1235 ProfileFunctionTrieNode* current = root; |
1234 current->Tick(); | 1236 current->Tick(); |
1235 | 1237 |
1236 // VM & User tags. | 1238 // VM & User tags. |
(...skipping 10 matching lines...) Expand all Loading... |
1247 frame_index--) { | 1249 frame_index--) { |
1248 ASSERT(sample->At(frame_index) != 0); | 1250 ASSERT(sample->At(frame_index) != 0); |
1249 current = ProcessFrame(current, sample_index, sample, frame_index); | 1251 current = ProcessFrame(current, sample_index, sample, frame_index); |
1250 } | 1252 } |
1251 } | 1253 } |
1252 } | 1254 } |
1253 | 1255 |
1254 void BuildExclusiveFunctionTrie(ProfileFunctionTrieNode* root) { | 1256 void BuildExclusiveFunctionTrie(ProfileFunctionTrieNode* root) { |
1255 ScopeTimer sw("ProfileBuilder::BuildExclusiveFunctionTrie", | 1257 ScopeTimer sw("ProfileBuilder::BuildExclusiveFunctionTrie", |
1256 FLAG_trace_profiler); | 1258 FLAG_trace_profiler); |
| 1259 ASSERT(tick_functions_); |
1257 for (intptr_t sample_index = 0; | 1260 for (intptr_t sample_index = 0; |
1258 sample_index < samples_->length(); | 1261 sample_index < samples_->length(); |
1259 sample_index++) { | 1262 sample_index++) { |
1260 ProcessedSample* sample = samples_->At(sample_index); | 1263 ProcessedSample* sample = samples_->At(sample_index); |
1261 | 1264 |
1262 // Tick the root. | 1265 // Tick the root. |
1263 ProfileFunctionTrieNode* current = root; | 1266 ProfileFunctionTrieNode* current = root; |
1264 current->Tick(); | 1267 current->Tick(); |
1265 | 1268 |
1266 // VM & User tags. | 1269 // VM & User tags. |
(...skipping 817 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2084 ASSERT(sample_buffer != NULL); | 2087 ASSERT(sample_buffer != NULL); |
2085 | 2088 |
2086 ClearProfileVisitor clear_profile(isolate); | 2089 ClearProfileVisitor clear_profile(isolate); |
2087 sample_buffer->VisitSamples(&clear_profile); | 2090 sample_buffer->VisitSamples(&clear_profile); |
2088 | 2091 |
2089 // Enable profile interrupts. | 2092 // Enable profile interrupts. |
2090 Profiler::BeginExecution(isolate); | 2093 Profiler::BeginExecution(isolate); |
2091 } | 2094 } |
2092 | 2095 |
2093 } // namespace dart | 2096 } // namespace dart |
OLD | NEW |