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 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
89 // Using the sync API means that we only record one event after the finish | 89 // Using the sync API means that we only record one event after the finish |
90 // time has been recorded. | 90 // time has been recorded. |
91 Timeline.startSync("ping"); | 91 Timeline.startSync("ping"); |
92 return _echo(idx, s).then((r) { | 92 return _echo(idx, s).then((r) { |
93 Timeline.finishSync(); | 93 Timeline.finishSync(); |
94 return r; | 94 return r; |
95 }); | 95 }); |
96 } | 96 } |
97 | 97 |
98 Future _echo(int idx, String s) { | 98 Future _echo(int idx, String s) { |
99 return _echoProxies[idx].ptr.echoString(s); | 99 return _echoProxies[idx].echoString(s); |
100 } | 100 } |
101 | 101 |
102 _errorHandler(Object e) { | 102 _errorHandler(Object e) { |
103 _doEcho = false; | 103 _doEcho = false; |
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 |