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

Side by Side Diff: runtime/vm/profiler_service.cc

Issue 1260753005: Restore first frame tick exception in exclusive trees (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years, 4 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 1177 matching lines...) Expand 10 before | Expand all | Expand 10 after
1188 1188
1189 // Walk the sampled PCs. 1189 // Walk the sampled PCs.
1190 for (intptr_t frame_index = 0; 1190 for (intptr_t frame_index = 0;
1191 frame_index < sample->length(); 1191 frame_index < sample->length();
1192 frame_index++) { 1192 frame_index++) {
1193 ASSERT(sample->At(frame_index) != 0); 1193 ASSERT(sample->At(frame_index) != 0);
1194 intptr_t index = 1194 intptr_t index =
1195 GetProfileCodeIndex(sample->At(frame_index), sample->timestamp()); 1195 GetProfileCodeIndex(sample->At(frame_index), sample->timestamp());
1196 ASSERT(index >= 0); 1196 ASSERT(index >= 0);
1197 current = current->GetChild(index); 1197 current = current->GetChild(index);
1198 current->Tick(); 1198 if (ShouldTickNode(sample, frame_index)) {
1199 current->Tick();
1200 }
1199 } 1201 }
1200
1201 // Truncated tag. 1202 // Truncated tag.
1202 if (sample->truncated()) { 1203 if (sample->truncated()) {
1203 current = AppendTruncatedTag(current); 1204 current = AppendTruncatedTag(current);
1204 } 1205 }
1205 } 1206 }
1206 } 1207 }
1207 1208
1208 void BuildFunctionTrie(Profile::TrieKind kind) { 1209 void BuildFunctionTrie(Profile::TrieKind kind) {
1209 ProfileFunctionTrieNode* root = 1210 ProfileFunctionTrieNode* root =
1210 new ProfileFunctionTrieNode( 1211 new ProfileFunctionTrieNode(
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after
1354 ProfileFunction* function = function_table->LookupOrAdd(*inlined_function); 1355 ProfileFunction* function = function_table->LookupOrAdd(*inlined_function);
1355 ASSERT(function != NULL); 1356 ASSERT(function != NULL);
1356 return ProcessFunction(current, 1357 return ProcessFunction(current,
1357 sample_index, 1358 sample_index,
1358 sample, 1359 sample,
1359 frame_index, 1360 frame_index,
1360 function, 1361 function,
1361 code_index); 1362 code_index);
1362 } 1363 }
1363 1364
1365 bool ShouldTickNode(ProcessedSample* sample, intptr_t frame_index) {
1366 if (frame_index != 0) {
1367 return true;
1368 }
1369 // Only tick the first frame's node, if we are executing OR
1370 // vm tags have been emitted.
1371 return IsExecutingFrame(sample, frame_index) || vm_tags_emitted();
1372 }
1373
1364 ProfileFunctionTrieNode* ProcessFunction(ProfileFunctionTrieNode* current, 1374 ProfileFunctionTrieNode* ProcessFunction(ProfileFunctionTrieNode* current,
1365 intptr_t sample_index, 1375 intptr_t sample_index,
1366 ProcessedSample* sample, 1376 ProcessedSample* sample,
1367 intptr_t frame_index, 1377 intptr_t frame_index,
1368 ProfileFunction* function, 1378 ProfileFunction* function,
1369 intptr_t code_index) { 1379 intptr_t code_index) {
1370 if (tick_functions_) { 1380 if (tick_functions_) {
1371 function->Tick(IsExecutingFrame(sample, frame_index), sample_index); 1381 function->Tick(IsExecutingFrame(sample, frame_index), sample_index);
1372 } 1382 }
1373 function->AddProfileCode(code_index); 1383 function->AddProfileCode(code_index);
1374 current = current->GetChild(function->table_index()); 1384 current = current->GetChild(function->table_index());
1385 if (ShouldTickNode(sample, frame_index)) {
1386 current->Tick();
1387 }
1375 current->AddCodeObjectIndex(code_index); 1388 current->AddCodeObjectIndex(code_index);
1376 current->Tick();
1377 return current; 1389 return current;
1378 } 1390 }
1379 1391
1380 // Tick the truncated tag's inclusive tick count. 1392 // Tick the truncated tag's inclusive tick count.
1381 void InclusiveTickTruncatedTag() { 1393 void InclusiveTickTruncatedTag() {
1382 ProfileCodeTable* tag_table = profile_->tag_code_; 1394 ProfileCodeTable* tag_table = profile_->tag_code_;
1383 intptr_t index = tag_table->FindCodeIndexForPC(VMTag::kTruncatedTagId); 1395 intptr_t index = tag_table->FindCodeIndexForPC(VMTag::kTruncatedTagId);
1384 ASSERT(index >= 0); 1396 ASSERT(index >= 0);
1385 ProfileCode* code = tag_table->At(index); 1397 ProfileCode* code = tag_table->At(index);
1386 code->IncInclusiveTicks(); 1398 code->IncInclusiveTicks();
(...skipping 700 matching lines...) Expand 10 before | Expand all | Expand 10 after
2087 ASSERT(sample_buffer != NULL); 2099 ASSERT(sample_buffer != NULL);
2088 2100
2089 ClearProfileVisitor clear_profile(isolate); 2101 ClearProfileVisitor clear_profile(isolate);
2090 sample_buffer->VisitSamples(&clear_profile); 2102 sample_buffer->VisitSamples(&clear_profile);
2091 2103
2092 // Enable profile interrupts. 2104 // Enable profile interrupts.
2093 Profiler::BeginExecution(isolate); 2105 Profiler::BeginExecution(isolate);
2094 } 2106 }
2095 2107
2096 } // namespace dart 2108 } // namespace dart
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698