README for the "test2" example directory.
$Id: README,v 1.7 1996/06/16 23:15:29 spreitze Exp $

[ Copyright (c) 1995--1996 Xerox Corporation.  All Rights Reserved.  

  Unlimited use, reproduction, and distribution of this software is
  permitted.  Any copy of this software must include both the above
  copyright notice of Xerox Corporation and this paragraph.  Any
  distribution of this software must comply with all applicable United
  States export control laws.  This software is made available AS IS,
  and XEROX CORPORATION DISCLAIMS ALL WARRANTIES, EXPRESS OR IMPLIED,
  INCLUDING WITHOUT LIMITATION THE IMPLIED WARRANTIES OF MERCHANTABILITY
  AND FITNESS FOR A PARTICULAR PURPOSE, AND NOTWITHSTANDING ANY OTHER
  PROVISION CONTAINED HEREIN, ANY LIABILITY FOR DAMAGES RESULTING FROM
  THE SOFTWARE OR ITS USE IS EXPRESSLY DISCLAIMED, WHETHER ARISING IN
  CONTRACT, TORT (INCLUDING NEGLIGENCE) OR STRICT LIABILITY, EVEN IF
  XEROX CORPORATION IS ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. ]

This directory is intended for tests of non-mainstream features.
There are currently two: a test of concurrent protocols, and a test of
ASYNCHRONOUS methods.  Both examples are available only in C.


I.  Concurrent Protocols

The concurrent protocol test consists of two objects that call each
other in a mutual recursion of selectable depth (and constant
branching factor of 2).  They compute a Fibbonacci number according to
the definition (Fib(n) = Fib(n-1) + Fib(n-2)), with each recursive
call going between the two objects.

The concurrent protocol test consists of one program, `fp`; command
line arguments tell it whether to be a server or client.  The
arguments to the client say which Fibbonacci is to be computed.  Both
sides take optional arguments specifying "pinfo" and "tinfo".  The
test is most interesting when a concurrent "pinfo" is given.

To build the concurrent protocol test,

% ilumkmf
% make fp

To run the server,

% setenv ILU_DEBUG SUNRPCRM
% ./fp
Usage: ./fp [-p pinfo] [-t tinfo [tinfo...]] [-st | -mt | -mte] (-s | -c n)
% ./fp -p csunrpc -s
ILU version 2.0alpha7.6.  Copyright 1990-1996 Xerox Corporation.
------------------------------------------------------------
Configuration info: big-endian, is BSD, is POSIX, Solaris 2 threads, size_t=size_t
  char=1s, short=2, int=4, long=4, void *=4, fnptr=4, long long=8, long double=16, enum=4,
  protocols = sunrpc courier iiop, transports = inmem tcp udp sunrpcrm secure,
  binding via shared files in /project/rpc/current/lib/binding
------------------------------------------------------------
ilu_SetDebugLevel:  setting debug mask from 0x0 to 0x80000
sunrpcrm(156a68): CreateMooring(lower=156a48)
my SBH = 'ilu:Fibber-Test-Server/it;ilu%3Ai5P8tLpwvh+a8ordp1Z3rnZVdlF;csunrpc_2_0x61a78_1266674080@sunrpcrm=tcp_13.2.116.108_46647'
Serving...

Then run the client

% setenv ILU_DEBUG SUNRPCRM
% ./fp -p csunrpc -c 4
ILU version 2.0alpha7.6.  Copyright 1990-1996 Xerox Corporation.
------------------------------------------------------------
Configuration info: big-endian, is BSD, is POSIX, Solaris 2 threads, size_t=size_t
  char=1s, short=2, int=4, long=4, void *=4, fnptr=4, long long=8, long double=16, enum=4,
  protocols = sunrpc courier iiop, transports = inmem tcp udp sunrpcrm secure,
  binding via shared files in /project/rpc/current/lib/binding
------------------------------------------------------------
ilu_SetDebugLevel:  setting debug mask from 0x0 to 0x80000
sunrpcrm(156a28): CreateMooring(lower=156a08)
my SBH = 'ilu:13.2.116.108.dc5.31be547a.2f96/it;ilu%3Ai5P8tLpwvh+a8ordp1Z3rnZVdlF;csunrpc_2_0x61a78_1266674080@sunrpcrm=tcp_13.2.116.108_46648'
sunrpcrm:NewTrans(lower=15b120) = 15b260
sunrpcrm(15b260): BeginMessage(output)
sunrpcrm(15b260): EndMessage(output, flush=1, last chunkSize=144)
sunrpcrm(15b260): BeginMessage(input)
sunrpcrm(15b260): Read 28 more bytes, in addition to 0 previous, of next chunk (incl header).
sunrpcrm(15b260): Parse header of length 24 chunk (last=1), 24 in buffer.
sunrpcrm(15b260): EndMessage(input)
sunrpcrm(15b260): BeginMessage(output)
sunrpcrm(15b260): EndMessage(output, flush=1, last chunkSize=288)
sunrpcrm:NewTrans(lower=15b410) = 15f6e0
sunrpcrm(15f6e0): BeginMessage(input)
sunrpcrm(15f6e0): Read 292 more bytes, in addition to 0 previous, of next chunk (incl header).
sunrpcrm(15f6e0): Parse header of length 288 chunk (last=1), 288 in buffer.
sunrpcrm(15f6e0): EndMessage(input)
..fib(3, d=2): calling step 1.
sunrpcrm(15b260): BeginMessage(output)
sunrpcrm(15b260): EndMessage(output, flush=1, last chunkSize=288)
sunrpcrm(15f6e0): BeginMessage(input)
sunrpcrm(15f6e0): Read 292 more bytes, in addition to 0 previous, of next chunk (incl header).
sunrpcrm(15f6e0): Parse header of length 288 chunk (last=1), 288 in buffer.
sunrpcrm(15f6e0): EndMessage(input)
....fib(1, d=4): returning 1.
sunrpcrm(15f6e0): BeginMessage(output)
sunrpcrm(15f6e0): EndMessage(output, flush=1, last chunkSize=32)
sunrpcrm(15f6e0): BeginMessage(input)
sunrpcrm(15f6e0): Read 292 more bytes, in addition to 0 previous, of next chunk (incl header).
sunrpcrm(15f6e0): Parse header of length 288 chunk (last=1), 288 in buffer.
sunrpcrm(15f6e0): EndMessage(input)
....fib(0, d=4): returning 1.
sunrpcrm(15f6e0): BeginMessage(output)
sunrpcrm(15f6e0): EndMessage(output, flush=1, last chunkSize=32)
sunrpcrm(15b260): BeginMessage(input)
sunrpcrm(15b260): Read 36 more bytes, in addition to 0 previous, of next chunk (incl header).
sunrpcrm(15b260): Parse header of length 32 chunk (last=1), 32 in buffer.
sunrpcrm(15b260): EndMessage(input)
..fib(3, d=2): calling step 2.
sunrpcrm(15b260): BeginMessage(output)
sunrpcrm(15b260): EndMessage(output, flush=1, last chunkSize=288)
sunrpcrm(15b260): BeginMessage(input)
sunrpcrm(15b260): Read 36 more bytes, in addition to 0 previous, of next chunk (incl header).
sunrpcrm(15b260): Parse header of length 32 chunk (last=1), 32 in buffer.
sunrpcrm(15b260): EndMessage(input)
..fib(3, d=2): returning 3.
sunrpcrm(15f6e0): BeginMessage(output)
sunrpcrm(15f6e0): EndMessage(output, flush=1, last chunkSize=32)
sunrpcrm(15b260): BeginMessage(input)
sunrpcrm(15b260): Read 0 more bytes, in addition to 0 previous, of next chunk (incl header).
sunrpcrm(15f6e0): BeginMessage(input)
sunrpcrm(15f6e0): Read 292 more bytes, in addition to 0 previous, of next chunk (incl header).
sunrpcrm(15f6e0): Parse header of length 288 chunk (last=1), 288 in buffer.
sunrpcrm(15f6e0): EndMessage(input)
..fib(2, d=2): calling step 1.
sunrpcrm(15b260): BeginMessage(output)
sunrpcrm(15b260): EndMessage(output, flush=1, last chunkSize=288)
sunrpcrm(15b260): BeginMessage(input)
sunrpcrm(15b260): Read 36 more bytes, in addition to 0 previous, of next chunk (incl header).
sunrpcrm(15b260): Parse header of length 32 chunk (last=1), 32 in buffer.
sunrpcrm(15b260): EndMessage(input)
..fib(2, d=2): calling step 2.
sunrpcrm(15b260): BeginMessage(output)
sunrpcrm(15b260): EndMessage(output, flush=1, last chunkSize=288)
sunrpcrm(15b260): BeginMessage(input)
sunrpcrm(15b260): Read 36 more bytes, in addition to 0 previous, of next chunk (incl header).
sunrpcrm(15b260): Parse header of length 32 chunk (last=1), 32 in buffer.
sunrpcrm(15b260): EndMessage(input)
..fib(2, d=2): returning 2.
sunrpcrm(15f6e0): BeginMessage(output)
sunrpcrm(15f6e0): EndMessage(output, flush=1, last chunkSize=32)
sunrpcrm(15b260): BeginMessage(input)
sunrpcrm(15b260): Read 0 more bytes, in addition to 0 previous, of next chunk (incl header).
sunrpcrm(15b260): BeginMessage(input)
sunrpcrm(15b260): Read 36 more bytes, in addition to 0 previous, of next chunk (incl header).
sunrpcrm(15b260): Parse header of length 32 chunk (last=1), 32 in buffer.
sunrpcrm(15b260): EndMessage(input)
Fib(4) = 5
% 

which should provoke output like the following on the server:

sunrpcrm:NewTrans(lower=15ab68) = 15abf0
sunrpcrm(15abf0): BeginMessage(input)
sunrpcrm(15abf0): Read 148 more bytes, in addition to 0 previous, of next chunk (incl header).
sunrpcrm(15abf0): Parse header of length 144 chunk (last=1), 144 in buffer.
sunrpcrm(15abf0): EndMessage(input)
sunrpcrm(15abf0): BeginMessage(output)
sunrpcrm(15abf0): EndMessage(output, flush=1, last chunkSize=24)
sunrpcrm(15abf0): BeginMessage(input)
sunrpcrm(15abf0): Read 292 more bytes, in addition to 0 previous, of next chunk (incl header).
sunrpcrm(15abf0): Parse header of length 288 chunk (last=1), 288 in buffer.
sunrpcrm(15abf0): EndMessage(input)
.fib(4, d=1): calling step 1.
sunrpcrm:NewTrans(lower=15ace0) = 15b498
sunrpcrm(15b498): BeginMessage(output)
sunrpcrm(15b498): EndMessage(output, flush=1, last chunkSize=288)
sunrpcrm(15abf0): BeginMessage(input)
sunrpcrm(15abf0): Read 292 more bytes, in addition to 0 previous, of next chunk (incl header).
sunrpcrm(15abf0): Parse header of length 288 chunk (last=1), 288 in buffer.
sunrpcrm(15abf0): EndMessage(input)
...fib(2, d=3): calling step 1.
sunrpcrm(15b498): BeginMessage(output)
sunrpcrm(15b498): EndMessage(output, flush=1, last chunkSize=288)
sunrpcrm(15b498): BeginMessage(input)
sunrpcrm(15b498): Read 36 more bytes, in addition to 0 previous, of next chunk (incl header).
sunrpcrm(15b498): Parse header of length 32 chunk (last=1), 32 in buffer.
sunrpcrm(15b498): EndMessage(input)
...fib(2, d=3): calling step 2.
sunrpcrm(15b498): BeginMessage(output)
sunrpcrm(15b498): EndMessage(output, flush=1, last chunkSize=288)
sunrpcrm(15b498): BeginMessage(input)
sunrpcrm(15b498): Read 36 more bytes, in addition to 0 previous, of next chunk (incl header).
sunrpcrm(15b498): Parse header of length 32 chunk (last=1), 32 in buffer.
sunrpcrm(15b498): EndMessage(input)
...fib(2, d=3): returning 2.
sunrpcrm(15abf0): BeginMessage(output)
sunrpcrm(15abf0): EndMessage(output, flush=1, last chunkSize=32)
sunrpcrm(15b498): BeginMessage(input)
sunrpcrm(15b498): Read 0 more bytes, in addition to 0 previous, of next chunk (incl header).
sunrpcrm(15abf0): BeginMessage(input)
sunrpcrm(15abf0): Read 292 more bytes, in addition to 0 previous, of next chunk (incl header).
sunrpcrm(15abf0): Parse header of length 288 chunk (last=1), 288 in buffer.
sunrpcrm(15abf0): EndMessage(input)
...fib(1, d=3): returning 1.
sunrpcrm(15abf0): BeginMessage(output)
sunrpcrm(15abf0): EndMessage(output, flush=1, last chunkSize=32)
sunrpcrm(15b498): BeginMessage(input)
sunrpcrm(15b498): Read 36 more bytes, in addition to 0 previous, of next chunk (incl header).
sunrpcrm(15b498): Parse header of length 32 chunk (last=1), 32 in buffer.
sunrpcrm(15b498): EndMessage(input)
.fib(4, d=1): calling step 2.
sunrpcrm(15b498): BeginMessage(output)
sunrpcrm(15b498): EndMessage(output, flush=1, last chunkSize=288)
sunrpcrm(15abf0): BeginMessage(input)
sunrpcrm(15abf0): Read 292 more bytes, in addition to 0 previous, of next chunk (incl header).
sunrpcrm(15abf0): Parse header of length 288 chunk (last=1), 288 in buffer.
sunrpcrm(15abf0): EndMessage(input)
...fib(1, d=3): returning 1.
sunrpcrm(15abf0): BeginMessage(output)
sunrpcrm(15abf0): EndMessage(output, flush=1, last chunkSize=32)
sunrpcrm(15abf0): BeginMessage(input)
sunrpcrm(15abf0): Read 292 more bytes, in addition to 0 previous, of next chunk (incl header).
sunrpcrm(15abf0): Parse header of length 288 chunk (last=1), 288 in buffer.
sunrpcrm(15abf0): EndMessage(input)
...fib(0, d=3): returning 1.
sunrpcrm(15abf0): BeginMessage(output)
sunrpcrm(15abf0): EndMessage(output, flush=1, last chunkSize=32)
sunrpcrm(15b498): BeginMessage(input)
sunrpcrm(15b498): Read 36 more bytes, in addition to 0 previous, of next chunk (incl header).
sunrpcrm(15b498): Parse header of length 32 chunk (last=1), 32 in buffer.
sunrpcrm(15b498): EndMessage(input)
.fib(4, d=1): returning 5.
sunrpcrm(15abf0): BeginMessage(output)
sunrpcrm(15abf0): EndMessage(output, flush=1, last chunkSize=32)
sunrpcrm(15abf0): BeginMessage(input)
sunrpcrm(15abf0): Read 0 more bytes, in addition to 0 previous, of next chunk (incl header).
sunrpcrm(15abf0): No more messages incoming.
sunrpcrm(15abf0): Close(lower=15ab68)
sunrpcrm(15b498): BeginMessage(input)
sunrpcrm(15b498): Read 0 more bytes, in addition to 0 previous, of next chunk (incl header).
sunrpcrm(15b498): No more messages incoming.
sunrpcrm(15b498): Close(lower=15ace0)

Check that "sunrpcrm:NewTrans" is printed exactly twice on each side;
that's evidence that multiple calls are sometimes outstanding on
connections.

This program can also be used to test multi-threading.  Giving the "-mt" switch causes OS-supplied threads to be used, if support for them is configured into ILU.  Giving the "-mte" switch goes further and causes each Fibbonacci calculation to be done by forking two threads to do the recursive calls.  "-st" requests single-threaded execution (the default, regardless of configuration).  Don't expect "sunrpcrm:NewTrans" to be printed exactly twice when using multiple threads.


II.  ASYNCHRONOUS Methods

The ASYNCHRONOUS method test involves two methods: a ASYNCHRONOUS and
a normal (synchronous) one.  The client consists of two nested loops.
Each iteration of the outer loop calls the ASYNCHRONOUS method NSEND
times (this is the inner loop), and then the synchronous method once.
The outer loop is repeated NSYNC times.  On each call, the client
passes the time (ilu_FineTime, to be specific) of the start of the
call, and the server records the time at which the actual method
executes.  The client sleeps for 1 second after each call on the
ASYNCHRONOUS method, to give clean separations of the times.  The
synchronous method returns this record of pairs of times, and clears
the timing buffer for the next series.  The client prints out the
pairs of times.  If the ASYNCHRONOUS feature is working, you should
see that in each series all call times precede all serving times.

The server takes optional arguments specifying pinfo and tinfo.

To build the ASYNCHRONOUS method test,

% ilumkmf
% make bsvr bclnt

To run the server,

% ./bsvr -help
Usage: ./bsvr [-p pinfo] [-t tinfo]
% ./bsvr -p bsunrpc
SBH = 'ilu:Batcher-Server/it;ilu%3Ak-lmMaRANKW88bREv8w2Uuu9erm;bsunrpc_2_0x61a78_1903640186@sunrpcrm=tcp_13.2.116.14_2197'

Then run the client:

% ./bclnt
Usage: ./bclnt n-syncs n-sends-per-sync
% ./bclnt 3 3
Ans(0) = 4
        808701766.206907->808701769.241622
        808701767.219225->808701769.242611
        808701768.230319->808701769.243263
        808701769.239055->808701769.243915

Ans(1) = 4
        808701769.264150->808701772.291410
        808701770.269161->808701772.292069
        808701771.281031->808701772.292706
        808701772.289489->808701772.293348

Ans(2) = 4
        808701772.307187->808701775.332846
        808701773.309603->808701775.333504
        808701774.319827->808701775.334145
        808701775.330895->808701775.334786

% 
