| 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 sample_profiler; |
| 6 | 6 |
| 7 abstract class CallTreeNode<NodeT extends M.CallTreeNode> | 7 abstract class CallTreeNode<NodeT extends M.CallTreeNode> |
| 8 implements M.CallTreeNode { | 8 implements M.CallTreeNode { |
| 9 final List<NodeT> children; | 9 final List<NodeT> children; |
| 10 final int count; | 10 final int count; |
| 11 final int inclusiveNativeAllocations; | 11 final int inclusiveNativeAllocations; |
| 12 final int exclusiveNativeAllocations; | 12 final int exclusiveNativeAllocations; |
| 13 double get percentage => _percentage; | 13 double get percentage => _percentage; |
| 14 double _percentage = 0.0; | 14 double _percentage = 0.0; |
| 15 final Set<String> attributes = new Set<String>(); | 15 final Set<String> attributes = new Set<String>(); |
| (...skipping 437 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 453 class InlineIntervalTick { | 453 class InlineIntervalTick { |
| 454 final int startAddress; | 454 final int startAddress; |
| 455 int _inclusiveTicks = 0; | 455 int _inclusiveTicks = 0; |
| 456 int get inclusiveTicks => _inclusiveTicks; | 456 int get inclusiveTicks => _inclusiveTicks; |
| 457 int _exclusiveTicks = 0; | 457 int _exclusiveTicks = 0; |
| 458 int get exclusiveTicks => _exclusiveTicks; | 458 int get exclusiveTicks => _exclusiveTicks; |
| 459 InlineIntervalTick(this.startAddress); | 459 InlineIntervalTick(this.startAddress); |
| 460 } | 460 } |
| 461 | 461 |
| 462 class ProfileCode implements M.ProfileCode { | 462 class ProfileCode implements M.ProfileCode { |
| 463 final CpuProfile profile; | 463 final SampleProfile profile; |
| 464 final Code code; | 464 final Code code; |
| 465 int exclusiveTicks; | 465 int exclusiveTicks; |
| 466 int inclusiveTicks; | 466 int inclusiveTicks; |
| 467 int exclusiveNativeAllocations; | 467 int exclusiveNativeAllocations; |
| 468 int inclusiveNativeAllocations; | 468 int inclusiveNativeAllocations; |
| 469 double normalizedExclusiveTicks = 0.0; | 469 double normalizedExclusiveTicks = 0.0; |
| 470 double normalizedInclusiveTicks = 0.0; | 470 double normalizedInclusiveTicks = 0.0; |
| 471 final addressTicks = new Map<int, CodeTick>(); | 471 final addressTicks = new Map<int, CodeTick>(); |
| 472 final intervalTicks = new Map<int, InlineIntervalTick>(); | 472 final intervalTicks = new Map<int, InlineIntervalTick>(); |
| 473 String formattedInclusiveTicks = ''; | 473 String formattedInclusiveTicks = ''; |
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 581 _recordCallee(ProfileCode callee, int count) { | 581 _recordCallee(ProfileCode callee, int count) { |
| 582 var r = callees[callee]; | 582 var r = callees[callee]; |
| 583 if (r == null) { | 583 if (r == null) { |
| 584 r = 0; | 584 r = 0; |
| 585 } | 585 } |
| 586 callees[callee] = r + count; | 586 callees[callee] = r + count; |
| 587 } | 587 } |
| 588 } | 588 } |
| 589 | 589 |
| 590 class ProfileFunction implements M.ProfileFunction { | 590 class ProfileFunction implements M.ProfileFunction { |
| 591 final CpuProfile profile; | 591 final SampleProfile profile; |
| 592 final ServiceFunction function; | 592 final ServiceFunction function; |
| 593 // List of compiled code objects containing this function. | 593 // List of compiled code objects containing this function. |
| 594 final List<ProfileCode> profileCodes = new List<ProfileCode>(); | 594 final List<ProfileCode> profileCodes = new List<ProfileCode>(); |
| 595 final Map<ProfileFunction, int> callers = new Map<ProfileFunction, int>(); | 595 final Map<ProfileFunction, int> callers = new Map<ProfileFunction, int>(); |
| 596 final Map<ProfileFunction, int> callees = new Map<ProfileFunction, int>(); | 596 final Map<ProfileFunction, int> callees = new Map<ProfileFunction, int>(); |
| 597 | 597 |
| 598 // Absolute ticks: | 598 // Absolute ticks: |
| 599 int exclusiveTicks = 0; | 599 int exclusiveTicks = 0; |
| 600 int inclusiveTicks = 0; | 600 int inclusiveTicks = 0; |
| 601 | 601 |
| (...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 740 | 740 |
| 741 _recordCallee(ProfileFunction callee, int count) { | 741 _recordCallee(ProfileFunction callee, int count) { |
| 742 var r = callees[callee]; | 742 var r = callees[callee]; |
| 743 if (r == null) { | 743 if (r == null) { |
| 744 r = 0; | 744 r = 0; |
| 745 } | 745 } |
| 746 callees[callee] = r + count; | 746 callees[callee] = r + count; |
| 747 } | 747 } |
| 748 } | 748 } |
| 749 | 749 |
| 750 // TODO(johnmccutchan): Rename to SampleProfile | 750 class SampleProfile extends M.SampleProfile { |
| 751 class CpuProfile extends M.SampleProfile { | |
| 752 Isolate isolate; | 751 Isolate isolate; |
| 753 | 752 |
| 754 int sampleCount = 0; | 753 int sampleCount = 0; |
| 755 int samplePeriod = 0; | 754 int samplePeriod = 0; |
| 756 double sampleRate = 0.0; | 755 double sampleRate = 0.0; |
| 757 | 756 |
| 758 int stackDepth = 0; | 757 int stackDepth = 0; |
| 759 | 758 |
| 760 double timeSpan = 0.0; | 759 double timeSpan = 0.0; |
| 761 | 760 |
| (...skipping 319 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1081 } | 1080 } |
| 1082 | 1081 |
| 1083 int approximateMillisecondsForCount(count) { | 1082 int approximateMillisecondsForCount(count) { |
| 1084 return (count * samplePeriod) ~/ Duration.MICROSECONDS_PER_MILLISECOND; | 1083 return (count * samplePeriod) ~/ Duration.MICROSECONDS_PER_MILLISECOND; |
| 1085 } | 1084 } |
| 1086 | 1085 |
| 1087 double approximateSecondsForCount(count) { | 1086 double approximateSecondsForCount(count) { |
| 1088 return (count * samplePeriod) / Duration.MICROSECONDS_PER_SECOND; | 1087 return (count * samplePeriod) / Duration.MICROSECONDS_PER_SECOND; |
| 1089 } | 1088 } |
| 1090 } | 1089 } |
| OLD | NEW |