crow/perf.crow
(source)
Functions for measuring performance.
Even non-summon
code is can measure perf, but only summon
code can access the measurements.
perf-result
record
total
duration
measures
symbol
[
measure-total
]
show
string
(a
perf-result
)
measure-total
record
Count and total duration of all measurements with the same name.
show
string
(a
measure-total
)
measure-performance
record
nominal
measure-performance
measure-performance
()
with-block
[t
] (t
, perf-result
) tuple2
(a
measure-performance
, f
mut
t
(void
)) summon
Enable performance, run the callback, then return its result and the measured performance.
perf-measure
record
nominal
measure-name
symbol
with-block
[t
] t
(a
perf-measure
, f
mut
t
(void
))
Runs f
and returns its result.
If the performance measure measure-name
is enabled,
this contribues to its performance measurement.