Skip to content

Commit 19e85e9

Browse files
committed
Let Profile module handle the flatten operation
It seems this has something to do with inlining. In any case, now that the module takes care of this, I don't have to worry about the semantics.
1 parent 8ed917d commit 19e85e9

File tree

1 file changed

+12
-14
lines changed

1 file changed

+12
-14
lines changed

src/StatProfilerHTML.jl

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@ function statprofilehtml(data::Array{UInt,1} = UInt[],litrace::Dict{UInt,Array{S
2424
(data, litrace) = Profile.retrieve()
2525
end
2626

27+
data, litrace = Profile.flatten(data, litrace)
28+
2729
withenv("PERL5LIB" => perllib) do
2830
open(`perl $statprofilehtml_pl $sharepath`, "w", stdout) do formatter
2931
lastwaszero = true
@@ -35,21 +37,17 @@ function statprofilehtml(data::Array{UInt,1} = UInt[],litrace::Dict{UInt,Array{S
3537
lastwaszero = true
3638
continue
3739
end
38-
# I don't understand the semantics of having more than one value in the array. Take
39-
# all of them
40-
frames= litrace[d]
41-
for frame in frames
42-
if !frame.from_c || from_c
43-
file = Base.find_source_file(string(frame.file))
44-
func_line = frame.line
45-
with_value(frame.linfo) do linfo
46-
func_line = linfo.def.line - 1 # off-by-one difference between how StatProfiler and julia seem to map this
47-
end
48-
49-
file_repr = file == nothing ? "nothing" : file
50-
write(formatter, "$(file_repr)\t$(frame.line)\t$(frame.func)\t$(func_line)\n")
51-
lastwaszero = false
40+
frame = litrace[d]
41+
if !frame.from_c || from_c
42+
file = Base.find_source_file(string(frame.file))
43+
func_line = frame.line
44+
with_value(frame.linfo) do linfo
45+
func_line = linfo.def.line - 1 # off-by-one difference between how StatProfiler and julia seem to map this
5246
end
47+
48+
file_repr = file == nothing ? "nothing" : file
49+
write(formatter, "$(file_repr)\t$(frame.line)\t$(frame.func)\t$(func_line)\n")
50+
lastwaszero = false
5351
end
5452
end
5553
end

0 commit comments

Comments
 (0)