# PAL Implementations

## The StdC PAL Implementation

### Command-Line Arguments

The standard C implementation creates a command-line program that accepts these arguments:

    Syntax: program [options...]
    Options:
      -s server        Server:port to connect to (localhost)
      -t level         Set trace level (default = 0)
                       0=none, 1=low, 2=medium, 3=high
      -r count         Repeat script count times, 0=forever (1)
      -c               Clock the script (0)
      -a               Animate: show script commands
      -e               Execute in single-step mode (0)
      -q               Quiet mode: no messages
      -v               Show version information
      -h               Show summary of command-line options
    The order of arguments is not important. Switches and filenames
    are case sensitive. See documentation for detailed information.

### Performance Measurements

The -c option clocks the script and produces performance measurement output. Here is an example of a simple stress test script:

    <?xml?>
    <pal
        name = "stress"
        script = "demo_pal_gen"
        >
        This script sends a large number of messages to a queue and then
        reads them back.  The number of messages can be specified on the
        command-line.
        <!-- fails on win32, see FOR-6
        <server name = "demo_srv" where = ".." />
        -->
        <session scope = "default" exchange = "myexchange" queue = "myqueue" >
            <set name = "number-of-messages" cmdline = "N" value = "1000" />
            <set name = "message-size" cmdline = "S" value = "1000" />
            <exchange_declare type = "fanout" />
            <queue_declare />
            <queue_bind />
            <repeat times = "$number-of-messages" counter = "index" progress = "100">
                <basic_content size = "$message-size" message_id = "id-$index" />
                <basic_publish routing_key = "myqueue" />
            </repeat>
            <while name = "arrived" test = "lt" value = "$number-of-messages" progress = "100">
                <basic_get />
                <basic_arrived>
                    <inc name = "arrived" />
                </basic_arrived>
            </while>
        </session>
    </pal>

Which produces this output (the figures are obviously just an example):

    ...........
    ...........
    16:41:26: I: elapsed time:781 msecs
    16:41:26: I: outgoing messages:1000 (976 Kbytes)
    16:41:26: I: incoming messages:1000 (976 Kbytes)
    16:41:26: I: total messages:2000 (1952 Kbytes) average:2560/sec (2499 Kbytes/sec)
    16:41:26: I: message latency min=280 max=410 mean=331 dev=37 msecs

## Other Implementations

There are no other implementations of PAL at present.