| OLD | NEW |
| 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 part of dart.vmstats; | 5 part of dart.vmstats; |
| 6 | 6 |
| 7 // Base class of model that reports changes to registered listeners. | 7 // Base class of model that reports changes to registered listeners. |
| 8 abstract class ObservableModel { | 8 abstract class ObservableModel { |
| 9 List<ModelListener> _listeners = []; | 9 List<ModelListener> _listeners = []; |
| 10 | 10 |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 76 Iterator<Isolate> get iterator => _isolates.iterator; | 76 Iterator<Isolate> get iterator => _isolates.iterator; |
| 77 | 77 |
| 78 int get length => _isolates.length; | 78 int get length => _isolates.length; |
| 79 | 79 |
| 80 Isolate operator[](int index) => _isolates[index]; | 80 Isolate operator[](int index) => _isolates[index]; |
| 81 } | 81 } |
| 82 | 82 |
| 83 | 83 |
| 84 // Model of a single isolate. | 84 // Model of a single isolate. |
| 85 class Isolate { | 85 class Isolate { |
| 86 final String handle; |
| 86 final String name; | 87 final String name; |
| 87 final int port; | 88 final int port; |
| 88 final int startTime; | 89 final int startTime; |
| 89 final int stackLimit; | 90 final int stackLimit; |
| 90 final Space newSpace; | 91 final Space newSpace; |
| 91 final Space oldSpace; | 92 final Space oldSpace; |
| 92 | 93 |
| 93 // Create an isolate from a map describing an isolate in the observed VM. | 94 // Create an isolate from a map describing an isolate in the observed VM. |
| 94 Isolate(Map raw): | 95 Isolate(Map raw): |
| 96 handle = raw['handle'], |
| 95 name = raw['name'], | 97 name = raw['name'], |
| 96 port = raw['port'], | 98 port = raw['port'], |
| 97 startTime = raw['starttime'], | 99 startTime = raw['starttime'], |
| 98 stackLimit = raw['stacklimit'], | 100 stackLimit = raw['stacklimit'], |
| 99 newSpace = new Space(raw['newspace']), | 101 newSpace = new Space(raw['newspace']), |
| 100 oldSpace = new Space(raw['oldspace']) {} | 102 oldSpace = new Space(raw['oldspace']) {} |
| 101 | 103 |
| 102 String toString() { | 104 String toString() { |
| 103 return '$name: ${newSpace.used + oldSpace.used}K'; | 105 return '$name: ${newSpace.used + oldSpace.used}K'; |
| 104 } | 106 } |
| 105 } | 107 } |
| 106 | 108 |
| 107 // Model of a memory space. | 109 // Model of a memory space. |
| 108 class Space { | 110 class Space { |
| 109 final int used; | 111 final int used; |
| 110 final int capacity; | 112 final int capacity; |
| 111 | 113 |
| 112 Space(Map raw): used = raw['used'], capacity = raw['capacity'] {} | 114 Space(Map raw): used = raw['used'], capacity = raw['capacity'] {} |
| 113 | 115 |
| 114 String toString() { | 116 String toString() { |
| 115 return 'used: $used capacity: $capacity'; | 117 return 'used: $used capacity: $capacity'; |
| 116 } | 118 } |
| 117 } | 119 } |
| OLD | NEW |