Latency takes two forms: latency due to processing, and latency due to sampling.
Processing latency is due to computation in a thread or processing by a device. This latency is
either determined by the latency property associated with the flow specification of the thread or
device, or by the deadline for a thread. Processing latency is also incurred during
communication across a connection and is reflected in the latency property associated with a
connection.
Sampling latency is due to a thread or device executing periodically independent of the arrival
of elements of a data stream. For data port connections, this applies to periodic threads with
delayed connections, and for aperiodic or stochastic threads. Immediate data port connections
result in processing latency only, since the destination thread execution is delayed until the
source thread has completed. Sampling latency may also be incurred if a bus periodically
transfers data.
The current flow latency analysis plug-in implements the following algorithm for determining the
end-to-end flow latency.
- For the first flow element – a FlowSpecInstance – processing latency is determined by
the latency property on the flow spec, or if not present by the deadline of a thread or
device. This is followed by accumulating the latency of alternating connection instances
and flow specification instances.
- Connection latency is determined by the latency property of the connection instance
and is added to the processing latency.
- For successive flow specification instances, latency is determined as follows:
- If the component has a partitionLatency property its value is used in calculating
sampling latency;
- If the component is a periodic thread with an incoming delayed data port or a event or
event data connection, then the thread period is used a sampling latency;
- If sampling occurs, the accumulated processing latency is rounded up to the next
multiple of the sampling latency; this value is then added to the total flow latency and
the accumulated processing latency reset to zero;
- If no sampling occurs, or after the total latency has been increased due to sampling,
then the accumulated processing latency is increased by the latency property value of
the flow specification, or if not present by the deadline of the thread or device;
- Once all flow elements are processed, the accumulated processing latency value is
added to the total latency.