# Interpreting output of Profile: Finding where code is called

**URL:** https://discourse.julialang.org/t/interpreting-output-of-profile-finding-where-code-is-called/90396
**Category:** Performance
**Created:** [November 17, 2022, 11:12am UTC](https://discourse.julialang.org/t/interpreting-output-of-profile-finding-where-code-is-called/90396 "2022-11-17T11:12:31Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![renatobellotti](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/renatobellotti/32/38793_2.png) [@renatobellotti](https://discourse.julialang.org/u/renatobellotti)
#### Post date: [November 17, 2022, 11:12am UTC](https://discourse.julialang.org/t/interpreting-output-of-profile-finding-where-code-is-called/90396/1 "2022-11-17T11:12:31Z")

</div>

Dear Julia enthusiasts,

I’m currently profiling an optimisation code that relies on `Optim.jl` and `Zygote` to calculate the gradients. Interestingly, about half of the runtime seems to be spent on creating and destroying tasks. My code does not use any multi-threading, and the optimisation library does not either as far as I could find.

Here my questions:

- Might the tasking be introduced by the profiling itself? Would that even show up in the report?
- Is there a way to find out where in the code is called from? Perhaps even if the call is hidden in some other function? Essentially I’d like to have a call graph.

Cheers,  
Renato

---

<div class="post-metadata">

### Author: ![renatobellotti](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/renatobellotti/32/38793_2.png) [@renatobellotti](https://discourse.julialang.org/u/renatobellotti)
#### Post date: [November 17, 2022, 12:04pm UTC](https://discourse.julialang.org/t/interpreting-output-of-profile-finding-where-code-is-called/90396/2 "2022-11-17T12:04:18Z")

</div>

Update:

I found out that the reported time spent in tasking really seems to come from profiling itself. Even for the following simple example it is visible:

```julia
using Profile
using Random
using StatProfilerHTML

function f(A, x)
    return A * x
end

A = rand(10_000, 10_000)
x = rand(10_000)

@profile f(A, x)
statprofilehtml()

```

Screenshot of the output (cropped at the top part):

 ![Screenshot from 2022-11-17 13-02-32](https://global.discourse-cdn.com/julialang/original/3X/3/1/31481ab9cd17f709d42a17d4135629aa66598332.png)
