Event timing
In .evt files, it is possible to specify the following:
Time intervals for sending batches of events to the correlator.
Waiting for all events on all queues at that point in time to be processed before sending the next event.
Adding BATCH tags to send events at intervals
You can specify time intervals for sending batches of events to the correlator. This is achieved by specifying the BATCH tag followed by a time offset in milliseconds. For example, the following specifies two batches of events to be sent 50 milliseconds apart.
BATCH 50
StockPrice("XRX", 11.1)
StockPrice("IBM", 130.6)
StockPrice("MSFT", 70.5)
BATCH 100
StockPrice("XRX", 11.0)
StockPrice("IBM", 130.8)
StockPrice("MSFT", 70.1)
The addition of a time allows simulations of bursts of events, or more random distributions of event traffic. Times are measured as an offset from when the current file was opened. If only one file of events is being read and transferred, then this would be the same as since the start of a run (that is, from the time that the engine_send tool starts processing the event data). If multiple files are being read in, the timing starts all over again upon the (re)opening of each file.
If the time given for a batch is less than the current time, or if no time is given following a BATCH tag (or if no BATCH tag is provided), then the events are sent as soon as they are read in, immediately following the preceding batch.
Using &FLUSHING mode for more predictable event processing order
Sending events in flushing mode can help provide a more predictable event processing order. However, flushing mode is slower than the default behavior.
By default, events are delivered in an optimal way, not waiting for previously sent events to be processed before the next event is delivered to contexts (or other consumers of channels). When flushing mode is enabled the behavior is as follows:
1. The correlator sends an event.
2. The correlator processes all events on all queues at that point in time, repeating this as many times as specified in the flushing specification.
3. The correlator sends the next event.
To enable flushing mode, insert the following line in a .evt file:
&FLUSHING(n)
Replace n with an integer that specifies how many times to flush queues in between each event. Set this to the maximum length of a chain of send-to operations between contexts that could occur in your application. If you specify a number that is bigger than required the correlator simply repeats the flush operation, which incurs a small overhead. To disable flushing mode, insert the following line in the .evt file:
&FLUSHING(0)
Enabling or disabling flushing mode affects only the events sent on that connection or from that event file.
When sending &TIME events in to a multi-context application, the time ticks are delivered directly to all contexts. This can be different than the way in which events in the .evt file are sent in to the correlator and then sent between contexts in an application. This difference can result in processing events at an incorrect simulated time. In these cases, sending &FLUSHING(1), for example, before sending time ticks and events can result in more predictable and reliable behavior.