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

Side by Side Diff: runtime/bin/vmservice/observatory/test/vm_metrics_test.dart

Issue 464953002: Add VMMetric and some sample metrics (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 4 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | runtime/vm/dart.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 import 'package:observatory/service_io.dart'; 1 import 'package:observatory/service_io.dart';
2 import 'package:unittest/unittest.dart'; 2 import 'package:unittest/unittest.dart';
3 import 'test_helper.dart'; 3 import 'test_helper.dart';
4 4
5 import 'dart:profiler'; 5 import 'dart:profiler';
6 6
7 void script() { 7 void script() {
8 var counter = new Counter('a.b.c', 'description'); 8 var counter = new Counter('a.b.c', 'description');
9 Metrics.register(counter); 9 Metrics.register(counter);
10 counter.value = 1234.5; 10 counter.value = 1234.5;
11 } 11 }
12 12
13 var tests = [ 13 var tests = [
14 14
15 (Isolate isolate) => 15 (Isolate isolate) =>
16 isolate.get('metrics').then((ServiceMap metrics) { 16 isolate.get('metrics/vm').then((ServiceMap metrics) {
17 expect(metrics['type'], equals('MetricList')); 17 expect(metrics['type'], equals('MetricList'));
18 var members = metrics['members']; 18 var members = metrics['members'];
19 expect(members, isList); 19 expect(members, isList);
20 expect(members.length, equals(1)); 20 expect(members.length, greaterThan(1));
21 var counter = members[0]; 21 var foundOldHeapCapacity = members.any((m) =>
22 expect(counter['name'], equals('a.b.c')); 22 m['name'] == 'heap.old.capacity');
23 expect(counter['value'], equals(1234.5)); 23 expect(foundOldHeapCapacity, equals(true));
24 }), 24 }),
25 25
26 (Isolate isolate) => 26 (Isolate isolate) =>
27 isolate.get('metrics/a.b.c').then((ServiceMap counter) { 27 isolate.get('metrics/vm/heap.old.used').then((ServiceMap counter) {
28 expect(counter['name'], equals('a.b.c')); 28 expect(counter['type'], equals('Counter'));
29 expect(counter['value'], equals(1234.5)); 29 expect(counter['name'], equals('heap.old.used'));
30 }), 30 }),
31 31
32 (Isolate isolate) => 32 (Isolate isolate) =>
33 isolate.get('metrics/a.b.d').then((DartError err) { 33 isolate.get('metrics/vm/doesnotexist').then((DartError err) {
34 expect(err is DartError, isTrue); 34 expect(err is DartError, isTrue);
35 }), 35 }),
36 36
37 ]; 37 ];
38 38
39 main(args) => runIsolateTests(args, tests, testeeBefore: script); 39 main(args) => runIsolateTests(args, tests, testeeBefore: script);
OLDNEW
« no previous file with comments | « no previous file | runtime/vm/dart.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698