Skip to content

Commit

Permalink
Remove unused old codes
Browse files Browse the repository at this point in the history
  • Loading branch information
kimikage committed May 9, 2024
1 parent 7338fcf commit e6e60aa
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 26 deletions.
2 changes: 1 addition & 1 deletion src/FlameGraphs.jl
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,6 @@ function _precompile_()
precompile(f, (Nothing, typeof(flamepixels), FlameColors, Node{NodeData}))
end
end
VERSION >= v"1.4.2" && _precompile_() # https://github.com/JuliaLang/julia/pull/35378
_precompile_()

end # module
28 changes: 3 additions & 25 deletions src/graph.jl
Original file line number Diff line number Diff line change
Expand Up @@ -31,26 +31,8 @@ const repl = UInt8(4)
const defaultpruned = Tuple{Symbol,Symbol}[]

# This allows Revise to correct the location information in profiles
if VERSION >= v"1.5.0-DEV.9"
# ref https://github.com/JuliaLang/julia/pull/34235
lineinfodict(data::Vector{<:Unsigned}) = Profile.getdict(data)
else
# Use the definition of Profile.getdict from Julia 1.5.0-DEV.9+
function lineinfodict(data::Vector{<:Unsigned})
# Lookup is expensive, so do it only once per ip.
udata = unique(data)
dict = Profile.LineInfoDict()
for ip in udata
st = Profile.lookup(convert(Ptr{Cvoid}, ip))
# To correct line numbers for moving code, put it in the form expected by
# Base.update_stackframes_callback[]
stn = map(x->(x, 1), st)
try Base.invokelatest(Base.update_stackframes_callback[], stn) catch end
dict[UInt64(ip)] = map(first, stn)
end
return dict
end
end
# ref https://github.com/JuliaLang/julia/pull/34235
lineinfodict(data::Vector{<:Unsigned}) = Profile.getdict(data)

"""
lidict = lineinfodict(uips)
Expand Down Expand Up @@ -116,11 +98,7 @@ function flamegraph(data=Profile.fetch(); lidict::Union{Dict{UInt64,Vector{Base.
else
threads === nothing || error("Specifying `threads` is not supported before julia 1.8")
tasks === nothing || error("Specifying `tasks` is not supported before julia 1.8")
if VERSION >= v"1.4.0-DEV.128"
root = Profile.tree!(root, data_u64, lidict, #= C =# true, recur)
else
root = Profile.tree!(root, data_u64, lidict, #= C =# true)
end
root = Profile.tree!(root, data_u64, lidict, #= C =# true, recur)
end
if isempty(root.down)
Profile.warning_empty()
Expand Down

0 comments on commit e6e60aa

Please sign in to comment.