Timer

com.ossuminc.riddl.utils.Timer
object Timer

Private implementation details which allow for more testability

Attributes

Source
Timer.scala
Graph
Supertypes
class Object
trait Matchable
class Any
Self type
Timer.type

Members list

Value members

Concrete methods

def time[T](stage: String, show: Boolean)(using io: PlatformContext)(f: => T): T

Runs a code block and returns its result, while recording its execution time, according to the passed clock.

Runs a code block and returns its result, while recording its execution time, according to the passed clock. Execution time is written to out, if show is set to true.

e.g.

timer(Clock.systemUTC(), System.out, "my-stage", true) { 1 + 1 } // 2

prints: Stage 'my-stage': 0.000 seconds

Value parameters

f

the code block to execute

out

the PrintStream to write execution time information to

show

if true, then message is printed, otherwise not

stage

The name of the stage, is included in output message

Attributes

Returns

The result of running f

Source
Timer.scala