Module: CMDx::Middlewares::Runtime
Overview
Middleware for measuring task execution runtime.
The Runtime middleware provides performance monitoring by measuring the execution time of tasks using monotonic clock for accuracy. It stores runtime measurements in task result metadata for analysis.
Instance Method Summary collapse
-
#call(task, **options) { ... } ⇒ Object
Middleware entry point that measures task execution runtime.
Instance Method Details
#call(task, **options) { ... } ⇒ Object
Middleware entry point that measures task execution runtime.
Evaluates the condition from options and measures execution time if enabled. Uses monotonic clock for precise timing measurements and stores the result in task metadata.
37 38 39 40 41 42 43 44 |
# File 'lib/cmdx/middlewares/runtime.rb', line 37 def call(task, **) return yield unless Utils::Condition.evaluate(task, ) now = monotonic_time result = yield task.result.[:runtime] = monotonic_time - now result end |