Contact Free trial Login

duration

duration(() -> T): DurationMeasurement<T>

Executes the input function and returns an object with execution time in milliseconds and result of that function.

Parameters

Name Description

valueToMeasure

A function to pass to duration.

Example

This example passes a wait function (defined in the header), which returns the execution time and result of that function in a DurationMeasurement object.

Source

%dw 2.0
output application/json
fun myFunction() = dw::Runtime::wait("My result",100)
---
dw::util::Timer::duration(() -> myFunction())

Output

{
  "time": 101,
  "result": "My result"
}

We use cookies to make interactions with our websites and services easy and meaningful, to better understand how they are used and to tailor advertising. You can read more and make your cookie choices here. By continuing to use this site you are giving us your consent to do this.