Widgets/Logic
Elapsed Widget
Elapsed Widget
A "Logic" type widget. Elapsed Widget calculates the amount of time elapsed (in milliseconds) since the last time it was triggered. It's perfect for measuring time intervals between events, performance monitoring, or creating time-based triggers.
Inputs
-
in (DataType: Anything) The main input port that triggers the time measurement. The first event starts the internal timer without producing output. Subsequent events will calculate and output the elapsed time since the previous event.
-
reset (DataType: Anything) Resets the internal timer to 0 without producing any output. Any data type can trigger the reset.
Outputs
- output (DataType: Number) Outputs the elapsed time in milliseconds since the last event was received on the in port.
Example
Execution Time Measurement
This example demonstrates how to use the Elapsed widget to measure the execution time of a script
Drag the example onto the workspace to explore and experiment!
In this example:
- The Button widget triggers the Sequence widget execution
- The Sequence widget executes two actions simultaneously:
- first starts the Elapsed widget timer,
- then triggers the Custom Script widget
- The Custom Script widget waits for 2 seconds and then completes
- When the script completes, it triggers the Elapsed widget again
- The Elapsed widget calculates and shows the execution time in milliseconds
📌 Additional Notes
- The first event on the in port only starts the timer and doesn't produce output
- The timer continues running even when no events are being processed
- The reset port accepts any data type to trigger a timer reset
- The Elapsed widget maintains its timer state until explicitly reset or the recipe is reloaded
- Time measurement has millisecond precision
Glossary
-
Custom Widget
A user-defined widget created using the Widget Group that encapsulates complex workflows into reusable components. Access it by clicking on the workspace and selecting "Create Widget Group" to build custom widgets.
-
Internal Timer
The Elapsed widget's built-in timing mechanism that tracks elapsed time between events, maintaining state until explicitly reset.
-
Recipe
A complete workflow composed of connected widgets that defines a specific automation or data processing task in Kemu.
-
Sequence Widget
A widget that executes multiple actions simultaneously, coordinating the execution of connected widgets in parallel rather than sequentially.