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

Side by Side Diff: runtime/observatory/lib/src/elements/cpu_profile.dart

Issue 1273323002: Make allocation profile configurable (tags, function v. code) (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 | « runtime/observatory/lib/src/elements/class_view.html ('k') | 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) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, 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 library cpu_profile_element; 5 library cpu_profile_element;
6 6
7 import 'dart:async'; 7 import 'dart:async';
8 import 'dart:html'; 8 import 'dart:html';
9 import 'observatory_element.dart'; 9 import 'observatory_element.dart';
10 import 'package:observatory/service.dart'; 10 import 'package:observatory/service.dart';
(...skipping 430 matching lines...) Expand 10 before | Expand all | Expand 10 after
441 Future<CpuProfile> reload(Isolate isolate) async { 441 Future<CpuProfile> reload(Isolate isolate) async {
442 profile.clear(); 442 profile.clear();
443 if (isolate == null) { 443 if (isolate == null) {
444 _update(profile); 444 _update(profile);
445 // Notify listener. 445 // Notify listener.
446 onSampleBufferUpdate(profile); 446 onSampleBufferUpdate(profile);
447 return profile; 447 return profile;
448 } 448 }
449 await _changeState(kFetchingState); 449 await _changeState(kFetchingState);
450 try { 450 try {
451 var params = { 'tags': tagSelector }; 451 var response;
452 var response = await isolate.invokeRpc('_getCpuProfile', params); 452 if (allocationProfileClass != null) {
453 response =
454 await allocationProfileClass.getAllocationSamples(tagSelector);
455 } else {
456 var params = { 'tags': tagSelector };
457 response = await isolate.invokeRpc('_getCpuProfile', params);
458 }
453 await _changeState(kLoadingState); 459 await _changeState(kLoadingState);
454 profile.load(isolate, response); 460 profile.load(isolate, response);
455 _update(profile); 461 _update(profile);
456 await _changeState(kLoadedState); 462 await _changeState(kLoadedState);
457 // Notify listener. 463 // Notify listener.
458 onSampleBufferUpdate(profile); 464 onSampleBufferUpdate(profile);
459 return profile; 465 return profile;
460 } catch (e, st) { 466 } catch (e, st) {
461 if (e is ServerRpcException) { 467 if (e is ServerRpcException) {
462 ServerRpcException se = e; 468 ServerRpcException se = e;
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
505 @observable bool showTagSelector = true; 511 @observable bool showTagSelector = true;
506 512
507 @observable String sampleCount = ''; 513 @observable String sampleCount = '';
508 @observable String refreshTime = ''; 514 @observable String refreshTime = '';
509 @observable String sampleRate = ''; 515 @observable String sampleRate = '';
510 @observable String stackDepth = ''; 516 @observable String stackDepth = '';
511 @observable String timeSpan = ''; 517 @observable String timeSpan = '';
512 @observable String fetchTime = ''; 518 @observable String fetchTime = '';
513 @observable String loadTime = ''; 519 @observable String loadTime = '';
514 @observable String tagSelector = 'UserVM'; 520 @observable String tagSelector = 'UserVM';
515 @observable String state = 'kFetching'; 521 @observable String state = kFetchingState;
516 @observable var exception; 522 @observable var exception;
517 @observable var stackTrace; 523 @observable var stackTrace;
518 524
519 static const kDisabledState = 'kDisabled'; 525 static const kDisabledState = 'kDisabled';
520 static const kExceptionState = 'Exception'; 526 static const kExceptionState = 'Exception';
521 static const kFetchingState = 'kFetching'; 527 static const kFetchingState = 'kFetching';
522 static const kLoadedState = 'kLoaded'; 528 static const kLoadedState = 'kLoaded';
523 static const kLoadingState = 'kLoading'; 529 static const kLoadingState = 'kLoading';
530 static const kNotLoadedState = 'kNotLoaded';
524 531
525 Isolate isolate; 532 Isolate isolate;
533 Class allocationProfileClass;
526 534
527 final CpuProfile profile = new CpuProfile(); 535 final CpuProfile profile = new CpuProfile();
528 final Stopwatch _stopWatch = new Stopwatch(); 536 final Stopwatch _stopWatch = new Stopwatch();
529 } 537 }
530 538
531 @CustomTag('stack-trace-tree-config') 539 @CustomTag('stack-trace-tree-config')
532 class StackTraceTreeConfigElement extends ObservatoryElement { 540 class StackTraceTreeConfigElement extends ObservatoryElement {
533 StackTraceTreeConfigElement.created() : super.created(); 541 StackTraceTreeConfigElement.created() : super.created();
534 542
535 void modeSelectorChanged(oldValue) { 543 void modeSelectorChanged(oldValue) {
(...skipping 633 matching lines...) Expand 10 before | Expand all | Expand 10 after
1169 return; 1177 return;
1170 } 1178 }
1171 var tree = profile.loadCodeTree(exclusive ? 'exclusive' : 'inclusive'); 1179 var tree = profile.loadCodeTree(exclusive ? 'exclusive' : 'inclusive');
1172 if (tree == null) { 1180 if (tree == null) {
1173 return; 1181 return;
1174 } 1182 }
1175 var rootRow = new CodeProfileTreeRow(codeTree, null, profile, tree.root); 1183 var rootRow = new CodeProfileTreeRow(codeTree, null, profile, tree.root);
1176 codeTree.initialize(rootRow); 1184 codeTree.initialize(rootRow);
1177 } 1185 }
1178 } 1186 }
OLDNEW
« no previous file with comments | « runtime/observatory/lib/src/elements/class_view.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698