Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Profile incorrectly records functions at line number 0 #34811

Open
atbug opened this issue Feb 19, 2020 · 0 comments
Open

Profile incorrectly records functions at line number 0 #34811

atbug opened this issue Feb 19, 2020 · 0 comments

Comments

@atbug
Copy link

atbug commented Feb 19, 2020

This issue was originally reported at JunoLab/Juno.jl#481 and was found to be an issue of the Profile package.

Running this file (saved as test.jl)

using LinearAlgebra, Profile

function bar(x)
    if x < 0.5
        return round(Int64, exp(x))
    else
        return exp(x)
    end
end

function foo(n)
    for i = 1:n
        for j = 1:10000
            bar(rand())
        end
    end
end

foo(3)

@profile foo(10000)

Profile.print(mincount=100)

gives

julia> include("test.jl")
599 .\client.jl:424; include(::String)
 599 .\Base.jl:31; include(::Module, ::String)
  599 .\loading.jl:1105; include_relative(::Module, ::String)
   599 .\boot.jl:328; include
    368 C:\Users\wangc\Temp\test.jl:0; foo(::Int64) # weird stuff here
     138 .\special\exp.jl:117; exp(::Float64)
    207 C:\Users\wangc\Temp\test.jl:14; foo(::Int64)
     158 ...b\v1.3\Random\src\Random.jl:256; rand
      141 ...lib\v1.3\Random\src\RNGs.jl:296; default_rng
       104 ...lib\v1.3\Random\src\RNGs.jl:298; default_rng(::Int64)
599 .\task.jl:333; (::REPL.var"#26#27"{REPL.REPLBackend})()
 599 ...\stdlib\v1.3\REPL\src\REPL.jl:118; macro expansion
  599 ...\stdlib\v1.3\REPL\src\REPL.jl:86; eval_user_input(::Any, ::REPL.REPLBackend)
   599 .\boot.jl:330; eval(::Module, ::Any)

The function foo is incorrectly reported at line 0 of test.jl.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant