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

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

Issue 1258363002: Restore code index tracking (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 1272 matching lines...) Expand 10 before | Expand all | Expand 10 after
1283 } 1283 }
1284 1284
1285 ProfileFunctionTrieNode* ProcessFrame( 1285 ProfileFunctionTrieNode* ProcessFrame(
1286 ProfileFunctionTrieNode* current, 1286 ProfileFunctionTrieNode* current,
1287 intptr_t sample_index, 1287 intptr_t sample_index,
1288 ProcessedSample* sample, 1288 ProcessedSample* sample,
1289 intptr_t frame_index) { 1289 intptr_t frame_index) {
1290 const uword pc = sample->At(frame_index); 1290 const uword pc = sample->At(frame_index);
1291 ProfileCode* profile_code = GetProfileCode(pc, 1291 ProfileCode* profile_code = GetProfileCode(pc,
1292 sample->timestamp()); 1292 sample->timestamp());
1293 const intptr_t code_index = profile_code->code_table_index();
1293 ASSERT(profile_code != NULL); 1294 ASSERT(profile_code != NULL);
1294 const Code& code = Code::ZoneHandle(profile_code->code()); 1295 const Code& code = Code::ZoneHandle(profile_code->code());
1295 GrowableArray<Function*> inlined_functions; 1296 GrowableArray<Function*> inlined_functions;
1296 if (!code.IsNull()) { 1297 if (!code.IsNull()) {
1297 intptr_t offset = pc - code.EntryPoint(); 1298 intptr_t offset = pc - code.EntryPoint();
1298 code.GetInlinedFunctionsAt(offset, &inlined_functions); 1299 code.GetInlinedFunctionsAt(offset, &inlined_functions);
1299 } 1300 }
1300 if (code.IsNull() || (inlined_functions.length() == 0)) { 1301 if (code.IsNull() || (inlined_functions.length() == 0)) {
1301 // No inlined functions. 1302 // No inlined functions.
1302 ProfileFunction* function = profile_code->function(); 1303 ProfileFunction* function = profile_code->function();
1303 ASSERT(function != NULL); 1304 ASSERT(function != NULL);
1304 current = ProcessFunction(current, 1305 current = ProcessFunction(current,
1305 sample_index, 1306 sample_index,
1306 sample, 1307 sample,
1307 frame_index, 1308 frame_index,
1308 function); 1309 function,
1310 code_index);
1309 return current; 1311 return current;
1310 } 1312 }
1311 1313
1312 if (inclusive_tree_) { 1314 if (inclusive_tree_) {
1313 for (intptr_t i = inlined_functions.length() - 1; i >= 0; i--) { 1315 for (intptr_t i = inlined_functions.length() - 1; i >= 0; i--) {
1314 Function* inlined_function = inlined_functions[i]; 1316 Function* inlined_function = inlined_functions[i];
1315 ASSERT(inlined_function != NULL); 1317 ASSERT(inlined_function != NULL);
1316 ASSERT(!inlined_function->IsNull()); 1318 ASSERT(!inlined_function->IsNull());
1317 current = ProcessInlinedFunction(current, 1319 current = ProcessInlinedFunction(current,
1318 sample_index, 1320 sample_index,
1319 sample, 1321 sample,
1320 frame_index, 1322 frame_index,
1321 inlined_function); 1323 inlined_function,
1324 code_index);
1322 } 1325 }
1323 } else { 1326 } else {
1324 for (intptr_t i = 0; i < inlined_functions.length(); i++) { 1327 for (intptr_t i = 0; i < inlined_functions.length(); i++) {
1325 Function* inlined_function = inlined_functions[i]; 1328 Function* inlined_function = inlined_functions[i];
1326 ASSERT(inlined_function != NULL); 1329 ASSERT(inlined_function != NULL);
1327 ASSERT(!inlined_function->IsNull()); 1330 ASSERT(!inlined_function->IsNull());
1328 current = ProcessInlinedFunction(current, 1331 current = ProcessInlinedFunction(current,
1329 sample_index, 1332 sample_index,
1330 sample, 1333 sample,
1331 frame_index + i, 1334 frame_index + i,
1332 inlined_function); 1335 inlined_function,
1336 code_index);
1333 } 1337 }
1334 } 1338 }
1335 1339
1336 return current; 1340 return current;
1337 } 1341 }
1338 1342
1339 ProfileFunctionTrieNode* ProcessInlinedFunction( 1343 ProfileFunctionTrieNode* ProcessInlinedFunction(
1340 ProfileFunctionTrieNode* current, 1344 ProfileFunctionTrieNode* current,
1341 intptr_t sample_index, 1345 intptr_t sample_index,
1342 ProcessedSample* sample, 1346 ProcessedSample* sample,
1343 intptr_t frame_index, 1347 intptr_t frame_index,
1344 Function* inlined_function) { 1348 Function* inlined_function,
1349 intptr_t code_index) {
1345 ProfileFunctionTable* function_table = profile_->functions_; 1350 ProfileFunctionTable* function_table = profile_->functions_;
1346 ProfileFunction* function = function_table->LookupOrAdd(*inlined_function); 1351 ProfileFunction* function = function_table->LookupOrAdd(*inlined_function);
1347 ASSERT(function != NULL); 1352 ASSERT(function != NULL);
1348 return ProcessFunction(current, 1353 return ProcessFunction(current,
1349 sample_index, 1354 sample_index,
1350 sample, 1355 sample,
1351 frame_index, 1356 frame_index,
1352 function); 1357 function,
1358 code_index);
1353 } 1359 }
1354 1360
1355 ProfileFunctionTrieNode* ProcessFunction(ProfileFunctionTrieNode* current, 1361 ProfileFunctionTrieNode* ProcessFunction(ProfileFunctionTrieNode* current,
1356 intptr_t sample_index, 1362 intptr_t sample_index,
1357 ProcessedSample* sample, 1363 ProcessedSample* sample,
1358 intptr_t frame_index, 1364 intptr_t frame_index,
1359 ProfileFunction* function) { 1365 ProfileFunction* function,
1366 intptr_t code_index) {
1360 if (tick_functions_) { 1367 if (tick_functions_) {
1361 function->Tick(IsExecutingFrame(sample, frame_index), sample_index); 1368 function->Tick(IsExecutingFrame(sample, frame_index), sample_index);
1362 } 1369 }
1370 function->AddProfileCode(code_index);
1363 current = current->GetChild(function->table_index()); 1371 current = current->GetChild(function->table_index());
1372 current->AddCodeObjectIndex(code_index);
1364 current->Tick(); 1373 current->Tick();
1365 return current; 1374 return current;
1366 } 1375 }
1367 1376
1368 // Tick the truncated tag's inclusive tick count. 1377 // Tick the truncated tag's inclusive tick count.
1369 void InclusiveTickTruncatedTag() { 1378 void InclusiveTickTruncatedTag() {
1370 ProfileCodeTable* tag_table = profile_->tag_code_; 1379 ProfileCodeTable* tag_table = profile_->tag_code_;
1371 intptr_t index = tag_table->FindCodeIndexForPC(VMTag::kTruncatedTagId); 1380 intptr_t index = tag_table->FindCodeIndexForPC(VMTag::kTruncatedTagId);
1372 ASSERT(index >= 0); 1381 ASSERT(index >= 0);
1373 ProfileCode* code = tag_table->At(index); 1382 ProfileCode* code = tag_table->At(index);
(...skipping 701 matching lines...) Expand 10 before | Expand all | Expand 10 after
2075 ASSERT(sample_buffer != NULL); 2084 ASSERT(sample_buffer != NULL);
2076 2085
2077 ClearProfileVisitor clear_profile(isolate); 2086 ClearProfileVisitor clear_profile(isolate);
2078 sample_buffer->VisitSamples(&clear_profile); 2087 sample_buffer->VisitSamples(&clear_profile);
2079 2088
2080 // Enable profile interrupts. 2089 // Enable profile interrupts.
2081 Profiler::BeginExecution(isolate); 2090 Profiler::BeginExecution(isolate);
2082 } 2091 }
2083 2092
2084 } // namespace dart 2093 } // 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