Cycle Timer
This function block measures the time elapsed between consecutive evaluations and provides that duration as a numeric value. It is useful for profiling steps, measuring loop or event periods, and monitoring runtime performance in real time.
π₯ Inputs
This function block does not have any inputs.
π€ Outputs
Seconds This output provides the elapsed time (in seconds) since the previous evaluation. On the very first evaluation after placement or reset, the output will be zero.
πΉοΈ Controls
No Controls This block has no user-facing controls. It automatically updates its internal timestamp each time it runs.
βοΈ Running mechanism
Each time the block is evaluated in the scenario, it compares the current time with the time recorded on the previous evaluation and returns their difference as
Seconds.The first evaluation acts as an initialization and returns zero since there is no previous timestamp.
Because the block measures elapsed wall-clock time, it provides high-resolution timing suitable for measuring short intervals between steps or events.
π― Features
Lightweight, automatic interval measurement without configuration.
High-resolution timing ideal for profiling and cycle monitoring.
Immediate availability of values for downstream processing or logging.
π Usage Instructions
Place the block in your scenario wherever you want to measure elapsed time between evaluations.
Read the
Secondsoutput in downstream blocks to log, analyze or trigger actions based on elapsed time.Remember that the first measurement after placement or reset returns zero.
Common combinations:
Use with
Rising EdgeorLogic Inputto measure time between discrete events or user-triggered actions.Use with image sources like
Camera USB,Stream ReaderorVideoto measure frame intervals or processing latency.Feed the output to
Roundfor a cleaner numeric presentation, or toScopeto display a live plot of cycle times.Send values to
CSV ExportorImage Loggerfor recording cycle time history.
π‘ Tips and Tricks
To monitor processing stability, pipe
SecondsintoScopeto visualize jitter and spikes over time.For long-term logging, use
CSV Exportto collect cycle times for offline analysis.When measuring between manual actions, combine with
Keyboard/Barcode ReaderorLogic Inputto capture precise event-to-event durations.If you need a formatted display, use
Roundto reduce decimal places before showing values in UI blocks.
π οΈ Troubleshooting
If you always see zero values, verify that the scenario is actually running repeatedly and not frozen; the first evaluation after placement or reset will be zero by design.
If measurements show unexpected very small intervals, ensure the block is not being evaluated multiple times per logical step by other flow constructs. Consider using an event trigger (for example
Rising Edge) so the block measures only at intended moments.To reduce noisy spikes in short-term measurements, smooth or average several consecutive
Secondsvalues using downstream processing or by logging and post-processing.
Last updated
Was this helpful?