I am beginner in Julia and try to understand the basics.

I have an ODE problem with 2 parameters (PI control). These are to be learned from a measurement series.

My loss function looks like this:

```
function loss(p)
prediction = solve(prob_nn, Euler(), dt=Δt, p=p, saveat = t, sensealg=ForwardDiffSensitivity(convert_tspan=true))
loss = sum(abs2, prediction[1:end-1,:].-X)
return loss, prediction
end
```

and it is called by sciml_train:

```
result_ode = DiffEqFlux.sciml_train(loss, G_nn, BFGS()) #, cb = callback)
```

The algorithm finds the desired parameters in 8 iterations. Now I would like to know how often my loss function is actually called. I suspect that will happen more than 8 times (not just for calculating the gradients).

How can I find out? I wanted to use Timeroutputs, but don’t know how. I can’t place the timer into the loss function like

```
@timeit to "loss_time" loss = sum(abs2, prediction[1:end-1,:].-X)
```

nor in sciml_train.

My next approach was the instrumenting profiler, but the IProfile package seems to be no longer available.

I would be very grateful if someone could help me with this problem.