OLD | NEW |
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, 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 service; | 5 part of service; |
6 | 6 |
7 /// State for a running isolate. | 7 /// State for a running isolate. |
8 class Isolate extends ServiceObject { | 8 class Isolate extends ServiceObject { |
9 final VM vm; | 9 final VM vm; |
10 String get link => _id; | 10 String get link => _id; |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
42 /// Creates a relative link to [id] with a '#/' prefix. | 42 /// Creates a relative link to [id] with a '#/' prefix. |
43 @reflectable String relativeHashLink(String id) => '#/${relativeLink(id)}'; | 43 @reflectable String relativeHashLink(String id) => '#/${relativeLink(id)}'; |
44 | 44 |
45 Future<ScriptCache> refreshCoverage() { | 45 Future<ScriptCache> refreshCoverage() { |
46 return get('coverage').then(_scripts._processCoverage); | 46 return get('coverage').then(_scripts._processCoverage); |
47 } | 47 } |
48 | 48 |
49 void processProfile(ServiceMap profile) { | 49 void processProfile(ServiceMap profile) { |
50 assert(profile.serviceType == 'Profile'); | 50 assert(profile.serviceType == 'Profile'); |
51 var codeTable = new List<Code>(); | 51 var codeTable = new List<Code>(); |
52 var profileCodes = profile['codes']; | 52 var codeRegions = profile['codes']; |
53 for (var profileCode in profileCodes) { | 53 for (var codeRegion in codeRegions) { |
54 Code code = profileCode['code']; | 54 Code code = codeRegion['code']; |
| 55 assert(code != null); |
55 codeTable.add(code); | 56 codeTable.add(code); |
56 } | 57 } |
57 _codes._resetProfileData(); | 58 _codes._resetProfileData(); |
58 _codes._updateProfileData(profile, codeTable); | 59 _codes._updateProfileData(profile, codeTable); |
59 } | 60 } |
60 | 61 |
61 /// Requests [serviceId] from [this]. Completes to a [ServiceObject]. | 62 /// Requests [serviceId] from [this]. Completes to a [ServiceObject]. |
62 /// Can return pre-existing, cached, [ServiceObject]s. | 63 /// Can return pre-existing, cached, [ServiceObject]s. |
63 Future<ServiceObject> get(String serviceId) { | 64 Future<ServiceObject> get(String serviceId) { |
64 if (_scripts.cachesId(serviceId)) { | 65 if (_scripts.cachesId(serviceId)) { |
(...skipping 421 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
486 calls.add(new CodeCallCount(codes[index], count)); | 487 calls.add(new CodeCallCount(codes[index], count)); |
487 } | 488 } |
488 // Sort to descending count order. | 489 // Sort to descending count order. |
489 calls.sort((a, b) => b.count - a.count); | 490 calls.sort((a, b) => b.count - a.count); |
490 } | 491 } |
491 | 492 |
492 | 493 |
493 void updateProfileData(Map profileData, | 494 void updateProfileData(Map profileData, |
494 List<Code> codeTable, | 495 List<Code> codeTable, |
495 int sampleCount) { | 496 int sampleCount) { |
496 // Assert we have a ProfileCode entry. | 497 // Assert we have a CodeRegion entry. |
497 assert(profileData['type'] == 'ProfileCode'); | 498 assert(profileData['type'] == 'CodeRegion'); |
498 // Assert we are handed profile data for this code object. | 499 // Assert we are handed profile data for this code object. |
499 assert(profileData['code'] == this); | 500 assert(profileData['code'] == this); |
500 totalSamplesInProfile = sampleCount; | 501 totalSamplesInProfile = sampleCount; |
501 inclusiveTicks = int.parse(profileData['inclusive_ticks']); | 502 inclusiveTicks = int.parse(profileData['inclusive_ticks']); |
502 exclusiveTicks = int.parse(profileData['exclusive_ticks']); | 503 exclusiveTicks = int.parse(profileData['exclusive_ticks']); |
503 _resolveCalls(callers, profileData['callers'], codeTable); | 504 _resolveCalls(callers, profileData['callers'], codeTable); |
504 _resolveCalls(callees, profileData['callees'], codeTable); | 505 _resolveCalls(callees, profileData['callees'], codeTable); |
505 var ticks = profileData['ticks']; | 506 var ticks = profileData['ticks']; |
506 if (ticks != null) { | 507 if (ticks != null) { |
507 _processTicks(ticks); | 508 _processTicks(ticks); |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
579 | 580 |
580 int _callCount(List<CodeCallCount> calls, Code code) { | 581 int _callCount(List<CodeCallCount> calls, Code code) { |
581 for (CodeCallCount caller in calls) { | 582 for (CodeCallCount caller in calls) { |
582 if (caller.code == code) { | 583 if (caller.code == code) { |
583 return caller.count; | 584 return caller.count; |
584 } | 585 } |
585 } | 586 } |
586 return 0; | 587 return 0; |
587 } | 588 } |
588 } | 589 } |
OLD | NEW |