diff --git a/base/timing.jl b/base/timing.jl index 9aa2208c90e6de..ab70a7dc567abc 100644 --- a/base/timing.jl +++ b/base/timing.jl @@ -634,7 +634,7 @@ macro timed(ex) ) local diff = GC_Diff(gc_num(), stats) local sched_times = Int[] - for i in 1:Threads.maxthreadid() + for i in 1:length(task_times_per_thread[]) # filter out zeros in task timers which can only happen if nothing was scheduled if task_times_per_thread[][i] != 0 # subtract task and sleep times from global elapsed time to get scheduling time per thread