Skip to content

Commit

Permalink
Fix time function qualification (#119)
Browse files Browse the repository at this point in the history
* Fix time function qualification

* Update ExecutionTests.jl
  • Loading branch information
musm authored and jrevels committed Oct 3, 2018
1 parent 850d1a7 commit e3af54b
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/execution.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 5 additions & 0 deletions test/ExecutionTests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -177,4 +177,9 @@ let fname = tempname()
end
end

# issue #107
let time = 2
@benchmark identity(time)
end

end # module

0 comments on commit e3af54b

Please sign in to comment.