You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@timeit could take an additional NamedTuple that refers to custom, user specified columns. addcolumn! can be used to insert a new column in a TimerOutput. setaccumulator! could be used to specify which function is used to accumulate the custom value in a custom column. Default can be +.
to =TimerOutput()
addcolumn!(to, :foo, 0) # last arg is default value for new entriessetaccumulator!(to, :foo, (+)) # function f to compute accumulated = f(accumulated, new_value) addcolumn!(to, :bar, 1)
setaccumulator!(to, :bar, (*))
@timeit to "nest 1"beginsleep(0.1)
@timeit to "level 2.1"sleep(0.1) (foo=1, bar=2)
for i in1:20; @timeit to "level 2.2"sleep(0.02) (,bar=2); endend@timeit to "nest 2"beginfor i in1:30; @timeit to "level 2.1"sleep(0.01); end@timeit to "level 2.2"sleep(0.1) (foo=4.5, bar=3)
end
Inside of begin ... end blocks, another macro @accum can be used in order to accumulate values computed inside a timed block.
functionf(x) = (sleep(rand(1:x)); rand(1:x))
addcolumn!(to, :randn, 0)
@timeit to "rand num"begin
n =f(10)
@accum to (,randn=n) # should not be timedend
The text was updated successfully, but these errors were encountered:
Idea to add custom columns to the tables:
@timeit
could take an additionalNamedTuple
that refers to custom, user specified columns.addcolumn!
can be used to insert a new column in aTimerOutput
.setaccumulator!
could be used to specify which function is used to accumulate the custom value in a custom column. Default can be+
.Inside of
begin ... end
blocks, another macro@accum
can be used in order to accumulate values computed inside a timed block.The text was updated successfully, but these errors were encountered: