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 part of cpu_profiler; | 5 part of cpu_profiler; |
6 | 6 |
7 class CodeCallTreeNode { | 7 class CodeCallTreeNode { |
8 final ProfileCode profileCode; | 8 final ProfileCode profileCode; |
9 final int count; | 9 final int count; |
10 double get percentage => _percentage; | 10 double get percentage => _percentage; |
(...skipping 352 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
363 } | 363 } |
364 } | 364 } |
365 } | 365 } |
366 | 366 |
367 ProfileCode.fromMap(this.profile, this.code, Map data) { | 367 ProfileCode.fromMap(this.profile, this.code, Map data) { |
368 assert(profile != null); | 368 assert(profile != null); |
369 assert(code != null); | 369 assert(code != null); |
370 | 370 |
371 code.profile = this; | 371 code.profile = this; |
372 | 372 |
373 if (code.isDartCode) { | 373 if (code.kind == CodeKind.Stub) { |
374 attributes.add('stub'); | |
375 } else if (code.kind == CodeKind.Dart) { | |
376 if (code.isNative) { | |
377 attributes.add('ffi'); // Not to be confused with a C function. | |
378 } else { | |
379 attributes.add('dart'); | |
380 } | |
381 if (code.hasIntrinsic) { | |
382 attributes.add('intrinsic'); | |
383 } | |
374 if (code.isOptimized) { | 384 if (code.isOptimized) { |
375 attributes.add('optimized'); | 385 attributes.add('optimized'); |
376 } else { | 386 } else { |
377 attributes.add('unoptimized'); | 387 attributes.add('unoptimized'); |
378 } | 388 } |
379 } | |
380 if (code.isDartCode) { | |
381 attributes.add('dart'); | |
382 } else if (code.kind == CodeKind.Tag) { | 389 } else if (code.kind == CodeKind.Tag) { |
383 attributes.add('tag'); | 390 attributes.add('tag'); |
384 } else if (code.kind == CodeKind.Native) { | 391 } else if (code.kind == CodeKind.Native) { |
385 attributes.add('native'); | 392 attributes.add('native'); |
386 } | 393 } |
387 inclusiveTicks = int.parse(data['inclusiveTicks']); | 394 inclusiveTicks = int.parse(data['inclusiveTicks']); |
388 exclusiveTicks = int.parse(data['exclusiveTicks']); | 395 exclusiveTicks = int.parse(data['exclusiveTicks']); |
389 | 396 |
390 normalizedExclusiveTicks = exclusiveTicks / profile.sampleCount; | 397 normalizedExclusiveTicks = exclusiveTicks / profile.sampleCount; |
391 | 398 |
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
509 return true; | 516 return true; |
510 } | 517 } |
511 } | 518 } |
512 return false; | 519 return false; |
513 } | 520 } |
514 | 521 |
515 void _addKindBasedAttributes(Set<String> attribs) { | 522 void _addKindBasedAttributes(Set<String> attribs) { |
516 if (function.kind == FunctionKind.kTag) { | 523 if (function.kind == FunctionKind.kTag) { |
517 attribs.add('tag'); | 524 attribs.add('tag'); |
518 } else if (function.kind == FunctionKind.kStub) { | 525 } else if (function.kind == FunctionKind.kStub) { |
519 attribs.add('dart'); | |
520 attribs.add('stub'); | 526 attribs.add('stub'); |
521 } else if (function.kind == FunctionKind.kNative) { | 527 } else if (function.kind == FunctionKind.kNative) { |
522 attribs.add('native'); | 528 attribs.add('native'); |
523 } else if (function.kind.isSynthetic()) { | 529 } else if (function.kind.isSynthetic()) { |
524 attribs.add('synthetic'); | 530 attribs.add('synthetic'); |
531 } else if (function.isNative) { | |
532 attribs.add('ffi'); // Not to be confused with a C function. | |
525 } else { | 533 } else { |
526 attribs.add('dart'); | 534 attribs.add('dart'); |
527 } | 535 } |
536 if (function.hasIntrinsic == true) { | |
rmacnak
2015/11/12 02:15:13
Hit checked mode error, which suggests this someti
Cutch
2015/11/12 17:33:52
Maybe rewrite to:
if ((function is ServiceFunctio
rmacnak
2015/11/12 21:50:46
It's hasIntrinsic that's null, not function.
| |
537 attribs.add('intrinsic'); | |
538 } | |
528 } | 539 } |
529 | 540 |
530 ProfileFunction.fromMap(this.profile, this.function, Map data) { | 541 ProfileFunction.fromMap(this.profile, this.function, Map data) { |
531 function.profile = this; | 542 function.profile = this; |
532 for (var codeIndex in data['codes']) { | 543 for (var codeIndex in data['codes']) { |
533 var profileCode = profile.codes[codeIndex]; | 544 var profileCode = profile.codes[codeIndex]; |
534 profileCodes.add(profileCode); | 545 profileCodes.add(profileCode); |
535 } | 546 } |
536 profileCodes.sort(_sortCodes); | 547 profileCodes.sort(_sortCodes); |
537 | 548 |
(...skipping 322 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
860 int approximateMillisecondsForCount(count) { | 871 int approximateMillisecondsForCount(count) { |
861 var MICROSECONDS_PER_MILLISECOND = 1000.0; | 872 var MICROSECONDS_PER_MILLISECOND = 1000.0; |
862 return (count * samplePeriod) ~/ MICROSECONDS_PER_MILLISECOND; | 873 return (count * samplePeriod) ~/ MICROSECONDS_PER_MILLISECOND; |
863 } | 874 } |
864 | 875 |
865 double approximateSecondsForCount(count) { | 876 double approximateSecondsForCount(count) { |
866 var MICROSECONDS_PER_SECOND = 1000000.0; | 877 var MICROSECONDS_PER_SECOND = 1000000.0; |
867 return (count * samplePeriod) / MICROSECONDS_PER_SECOND; | 878 return (count * samplePeriod) / MICROSECONDS_PER_SECOND; |
868 } | 879 } |
869 } | 880 } |
OLD | NEW |