132
|
1 /*******************************************************************************
|
|
2
|
|
3
|
|
4 *******************************************************************************/
|
|
5
|
|
6 import Add;
|
|
7
|
|
8 import tango.io.Stdout;
|
|
9
|
|
10 import tango.time.StopWatch;
|
|
11
|
|
12 import tango.util.log.Configurator;
|
|
13
|
|
14 import tango.net.cluster.tina.ClusterTask;
|
|
15
|
|
16 /*******************************************************************************
|
|
17
|
|
18
|
|
19 *******************************************************************************/
|
|
20
|
|
21 void main (char[][] args)
|
|
22 {
|
|
23 // an implicit task instance
|
|
24 auto add = new NetCall!(add);
|
|
25
|
|
26 // an explicit task instance
|
|
27 auto sub = new Subtract;
|
|
28
|
|
29 StopWatch w;
|
|
30 while (true)
|
|
31 {
|
|
32 w.start;
|
|
33 for (int i=10000; i--;)
|
|
34 {
|
|
35 // both task types are used in the same manner
|
|
36 add (1, 2);
|
|
37 sub (3, 4);
|
|
38 }
|
|
39 Stdout.formatln ("{} calls/s", 20000/w.stop);
|
|
40 }
|
|
41 }
|
|
42
|