# How to get ticks elapsed by CPLEX solver with JuMP?

**URL:** <https://discourse.julialang.org/t/how-to-get-ticks-elapsed-by-cplex-solver-with-jump/58619>\
**Category:** Optimization (Mathematical)\
**Created:** [April 5, 2021, 2:28pm UTC](https://discourse.julialang.org/t/how-to-get-ticks-elapsed-by-cplex-solver-with-jump/58619 "2021-04-05T14:28:38Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Antell](https://avatars.discourse-cdn.com/v4/letter/a/85e7bf/32.png) [@Antell](https://discourse.julialang.org/u/Antell)\
**Post date:** [April 5, 2021, 2:28pm UTC](https://discourse.julialang.org/t/how-to-get-ticks-elapsed-by-cplex-solver-with-jump/58619/1 "2021-04-05T14:28:38Z")

</div>

I would like to call the `getDetTime` function from [IBM Documentation](https://www.ibm.com/docs/en/icos/20.1.0?topic=interface-using-timing) on a model, in order to get the amount of deterministic ticks that have elapsed during a call to `optimize!`. I cannot figure out how to use the new CPLEX.jl API to call this C function. This is my current code:

```julia
# set up the model m in direct mode
optimize!(m)

env = backend(m).env
dettime_P = Ref{Cint}()
CPLEX.CPXgetdettime(env, dettime_P)

```

This returns:

```julia
MethodError: no method matching unsafe_convert(::Type{Ptr{Float64}}, ::Base.RefValue{Int32})
Closest candidates are:
  unsafe_convert(!Matched::Type{Ptr{Nothing}}, ::Base.RefValue{T}) where T at refvalue.jl:30
  unsafe_convert(::Type{T}, !Matched::T) where T<:Ptr at essentials.jl:391
  unsafe_convert(::Type{Ptr{T}}, !Matched::Ptr{Tuple{Vararg{T,N}}}) where {N, T} at refpointer.jl:136

```

How do I fix this?

---

<div class="post-metadata">

**Author:** ![Henrique\_Becker](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/henrique_becker/32/15443_2.png) [@Henrique\_Becker](https://discourse.julialang.org/u/Henrique_Becker)\
**Post date:** [April 5, 2021, 4:04pm UTC](https://discourse.julialang.org/t/how-to-get-ticks-elapsed-by-cplex-solver-with-jump/58619/2 "2021-04-05T16:04:43Z")

</div>

It seems like the number of ticks is stored in a `Float64` not a `Cint`, so you probably should be using `dettime_P = Ref{Float64}()`, instead of `dettime_P = Ref{Cint}()`, or something like that.
