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

Side by Side Diff: runtime/observatory/lib/src/service/object.dart

Issue 1231603008: Expose allocation tracing over service protocol (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years, 5 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
OLDNEW
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 /// Helper function for canceling a Future<StreamSubscription>. 7 /// Helper function for canceling a Future<StreamSubscription>.
8 Future cancelFutureSubscription( 8 Future cancelFutureSubscription(
9 Future<StreamSubscription> subscriptionFuture) async { 9 Future<StreamSubscription> subscriptionFuture) async {
10 if (subscriptionFuture != null) { 10 if (subscriptionFuture != null) {
(...skipping 1878 matching lines...) Expand 10 before | Expand all | Expand 10 after
1889 @observable SourceLocation location; 1889 @observable SourceLocation location;
1890 1890
1891 @observable ServiceMap error; 1891 @observable ServiceMap error;
1892 @observable int vmCid; 1892 @observable int vmCid;
1893 1893
1894 final Allocations newSpace = new Allocations(); 1894 final Allocations newSpace = new Allocations();
1895 final Allocations oldSpace = new Allocations(); 1895 final Allocations oldSpace = new Allocations();
1896 final AllocationCount promotedByLastNewGC = new AllocationCount(); 1896 final AllocationCount promotedByLastNewGC = new AllocationCount();
1897 1897
1898 @observable bool get hasNoAllocations => newSpace.empty && oldSpace.empty; 1898 @observable bool get hasNoAllocations => newSpace.empty && oldSpace.empty;
1899 1899 @observable bool traceAllocations = false;
1900 @reflectable final fields = new ObservableList<Field>(); 1900 @reflectable final fields = new ObservableList<Field>();
1901 @reflectable final functions = new ObservableList<ServiceFunction>(); 1901 @reflectable final functions = new ObservableList<ServiceFunction>();
1902 1902
1903 @observable Class superclass; 1903 @observable Class superclass;
1904 @reflectable final interfaces = new ObservableList<Instance>(); 1904 @reflectable final interfaces = new ObservableList<Instance>();
1905 @reflectable final subclasses = new ObservableList<Class>(); 1905 @reflectable final subclasses = new ObservableList<Class>();
1906 1906
1907 bool get canCache => true; 1907 bool get canCache => true;
1908 bool get immutable => false; 1908 bool get immutable => false;
1909 1909
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
1956 functions.addAll(map['functions']); 1956 functions.addAll(map['functions']);
1957 functions.sort(ServiceObject.LexicalSortName); 1957 functions.sort(ServiceObject.LexicalSortName);
1958 1958
1959 superclass = map['super']; 1959 superclass = map['super'];
1960 // Work-around Object not tracking its subclasses in the VM. 1960 // Work-around Object not tracking its subclasses in the VM.
1961 if (superclass != null && superclass.name == "Object") { 1961 if (superclass != null && superclass.name == "Object") {
1962 superclass._addSubclass(this); 1962 superclass._addSubclass(this);
1963 } 1963 }
1964 error = map['error']; 1964 error = map['error'];
1965 1965
1966 traceAllocations =
1967 (map['_traceAllocations'] != null) ? map['_traceAllocations'] : false;
1968
1966 var allocationStats = map['_allocationStats']; 1969 var allocationStats = map['_allocationStats'];
1967 if (allocationStats != null) { 1970 if (allocationStats != null) {
1968 newSpace.update(allocationStats['new']); 1971 newSpace.update(allocationStats['new']);
1969 oldSpace.update(allocationStats['old']); 1972 oldSpace.update(allocationStats['old']);
1970 notifyPropertyChange(#hasNoAllocations, 0, 1); 1973 notifyPropertyChange(#hasNoAllocations, 0, 1);
1971 promotedByLastNewGC.instances = allocationStats['promotedInstances']; 1974 promotedByLastNewGC.instances = allocationStats['promotedInstances'];
1972 promotedByLastNewGC.bytes = allocationStats['promotedBytes']; 1975 promotedByLastNewGC.bytes = allocationStats['promotedBytes'];
1973 } 1976 }
1974 } 1977 }
1975 1978
1976 void _addSubclass(Class subclass) { 1979 void _addSubclass(Class subclass) {
1977 if (subclasses.contains(subclass)) { 1980 if (subclasses.contains(subclass)) {
1978 return; 1981 return;
1979 } 1982 }
1980 subclasses.add(subclass); 1983 subclasses.add(subclass);
1981 subclasses.sort(ServiceObject.LexicalSortName); 1984 subclasses.sort(ServiceObject.LexicalSortName);
1982 } 1985 }
1983 1986
1984 Future<ServiceObject> evaluate(String expression) { 1987 Future<ServiceObject> evaluate(String expression) {
1985 return isolate._eval(this, expression); 1988 return isolate._eval(this, expression);
1986 } 1989 }
1987 1990
1991 Future<ServiceObject> setTraceAllocations(bool enable) {
1992 return isolate.invokeRpc('_setTraceClassAllocation', {
1993 'enable': enable,
1994 'classId': id,
1995 });
1996 }
1997
1998 Future<ServiceObject> getAllocationSamples([String tags = 'None']) {
1999 var params = { 'tags': tags,
2000 'classId': id };
2001 return isolate.invokeRpc('_getAllocationSamples', params);
2002 }
2003
1988 String toString() => 'Class($vmName)'; 2004 String toString() => 'Class($vmName)';
1989 } 2005 }
1990 2006
1991 class Instance extends ServiceObject { 2007 class Instance extends ServiceObject {
1992 @observable String kind; 2008 @observable String kind;
1993 @observable Class clazz; 2009 @observable Class clazz;
1994 @observable int size; 2010 @observable int size;
1995 @observable int retainedSize; 2011 @observable int retainedSize;
1996 @observable String valueAsString; // If primitive. 2012 @observable String valueAsString; // If primitive.
1997 @observable bool valueAsStringIsTruncated; 2013 @observable bool valueAsStringIsTruncated;
(...skipping 1558 matching lines...) Expand 10 before | Expand all | Expand 10 after
3556 var v = list[i]; 3572 var v = list[i];
3557 if ((v is ObservableMap) && _isServiceMap(v)) { 3573 if ((v is ObservableMap) && _isServiceMap(v)) {
3558 list[i] = owner.getFromMap(v); 3574 list[i] = owner.getFromMap(v);
3559 } else if (v is ObservableList) { 3575 } else if (v is ObservableList) {
3560 _upgradeObservableList(v, owner); 3576 _upgradeObservableList(v, owner);
3561 } else if (v is ObservableMap) { 3577 } else if (v is ObservableMap) {
3562 _upgradeObservableMap(v, owner); 3578 _upgradeObservableMap(v, owner);
3563 } 3579 }
3564 } 3580 }
3565 } 3581 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698