I think you want time_run.
julia> f(x) = (sum(x)-1)^2
f (generic function with 1 method)
julia> sol = optimize(f, rand(100), GradientDescent())
* Status: success
[...]
julia> Optim.time_run(sol)
2.7894973754882812e-5
It’s not exported though and thus needs to be accessed with Optim.time_run or imported explicitly.