From e3af54b4b080d1e74a5a2de7f3c6bcae51581139 Mon Sep 17 00:00:00 2001 From: Mus Date: Wed, 3 Oct 2018 11:53:57 -0400 Subject: [PATCH] Fix time function qualification (#119) * Fix time function qualification * Update ExecutionTests.jl --- src/execution.jl | 4 ++-- test/ExecutionTests.jl | 5 +++++ 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/execution.jl b/src/execution.jl index 1d46133..970b887 100644 --- a/src/execution.jl +++ b/src/execution.jl @@ -321,14 +321,14 @@ function generate_benchmark_definition(eval_module, out_vars, setup_vars, core, params = $BenchmarkTools.Parameters(p; kwargs...) @assert params.seconds > 0.0 "time limit must be greater than 0.0" params.gctrial && $BenchmarkTools.gcscrub() - start_time = time() + start_time = Base.time() trial = $BenchmarkTools.Trial(params) params.gcsample && $BenchmarkTools.gcscrub() s = $(samplefunc)(params) push!(trial, s[1:end-1]...) return_val = s[end] iters = 2 - while (time() - start_time) < params.seconds && iters ≤ params.samples + while (Base.time() - start_time) < params.seconds && iters ≤ params.samples params.gcsample && $BenchmarkTools.gcscrub() push!(trial, $(samplefunc)(params)[1:end-1]...) iters += 1 diff --git a/test/ExecutionTests.jl b/test/ExecutionTests.jl index 54049a0..f22893e 100644 --- a/test/ExecutionTests.jl +++ b/test/ExecutionTests.jl @@ -177,4 +177,9 @@ let fname = tempname() end end +# issue #107 +let time = 2 + @benchmark identity(time) +end + end # module