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

  1. Place the block in your scenario wherever you want to measure elapsed time between evaluations.

  2. Read the Seconds output in downstream blocks to log, analyze or trigger actions based on elapsed time.

  3. Remember that the first measurement after placement or reset returns zero.

Common combinations:

  • Use with Rising Edge or Logic Input to measure time between discrete events or user-triggered actions.

  • Use with image sources like Camera USB, Stream Reader or Video to measure frame intervals or processing latency.

  • Feed the output to Round for a cleaner numeric presentation, or to Scope to display a live plot of cycle times.

  • Send values to CSV Export or Image Logger for recording cycle time history.

πŸ’‘ Tips and Tricks

  • To monitor processing stability, pipe Seconds into Scope to visualize jitter and spikes over time.

  • For long-term logging, use CSV Export to collect cycle times for offline analysis.

  • When measuring between manual actions, combine with Keyboard/Barcode Reader or Logic Input to capture precise event-to-event durations.

  • If you need a formatted display, use Round to 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 Seconds values using downstream processing or by logging and post-processing.

Last updated

Was this helpful?