OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 // This Mojo app is a benchmark of Mojo/Dart IPC Round Trip Times. | 5 // This Mojo app is a benchmark of Mojo/Dart IPC Round Trip Times. |
6 // It creates many proxies from a single isolate, and makes requests using those | 6 // It creates many proxies from a single isolate, and makes requests using those |
7 // proxies round-robin. | 7 // proxies round-robin. |
8 // To run it, and the other RTT benchmarks: | 8 // To run it, and the other RTT benchmarks: |
9 // | 9 // |
10 // $ ./mojo/devtools/common/mojo_benchmark [--release] mojo/tools/data/rtt_bench
marks | 10 // $ ./mojo/devtools/common/mojo_benchmark [--release] mojo/tools/data/rtt_bench
marks |
(...skipping 29 matching lines...) Expand all Loading... |
40 String echoUrl = "mojo:dart_echo_server"; | 40 String echoUrl = "mojo:dart_echo_server"; |
41 if (argResults["cpp-server"]) { | 41 if (argResults["cpp-server"]) { |
42 echoUrl = "mojo:echo_server"; | 42 echoUrl = "mojo:echo_server"; |
43 } | 43 } |
44 _numClients = int.parse(argResults["num-clients"]); | 44 _numClients = int.parse(argResults["num-clients"]); |
45 _numActiveClients = int.parse(argResults["num-active-clients"]); | 45 _numActiveClients = int.parse(argResults["num-active-clients"]); |
46 | 46 |
47 // Setup the connection to the echo app. | 47 // Setup the connection to the echo app. |
48 for (int i = 0; i < _numClients; i++) { | 48 for (int i = 0; i < _numClients; i++) { |
49 var newProxy = new EchoProxy.unbound(); | 49 var newProxy = new EchoProxy.unbound(); |
50 newProxy.errorFuture.then((e) { | 50 newProxy.ctrl.errorFuture.then((e) { |
51 _errorHandler(e); | 51 _errorHandler(e); |
52 }); | 52 }); |
53 connectToService(echoUrl, newProxy); | 53 connectToService(echoUrl, newProxy); |
54 _echoProxies.add(newProxy); | 54 _echoProxies.add(newProxy); |
55 } | 55 } |
56 | 56 |
57 // Start echoing. | 57 // Start echoing. |
58 _doEcho = true; | 58 _doEcho = true; |
59 Timer.run(() => _run(0)); | 59 Timer.run(() => _run(0)); |
60 | 60 |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
104 return Future.wait(_echoProxies.map((p) => p.close())).then((_) { | 104 return Future.wait(_echoProxies.map((p) => p.close())).then((_) { |
105 MojoHandle.reportLeakedHandles(); | 105 MojoHandle.reportLeakedHandles(); |
106 }); | 106 }); |
107 } | 107 } |
108 } | 108 } |
109 | 109 |
110 main(List args, Object handleToken) { | 110 main(List args, Object handleToken) { |
111 MojoHandle appHandle = new MojoHandle(handleToken); | 111 MojoHandle appHandle = new MojoHandle(handleToken); |
112 new EchoTracingApp.fromHandle(appHandle); | 112 new EchoTracingApp.fromHandle(appHandle); |
113 } | 113 } |
OLD | NEW |