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

Fix #93 #98

Merged
merged 4 commits into from
Sep 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 8 additions & 5 deletions src/PProf.jl
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,12 @@ function pprof(data::Union{Nothing, Vector{UInt}} = nothing,
]
idx -= (Profile.nmeta + 2) # skip all the metas, plus the 2 nulls that end a block.
continue
elseif !has_meta && data[idx] == 0
elseif data[idx] == 0
if has_meta
# This should never happen in has_meta mode
@error "Unexpected 0 in data, please file an issue." idx
continue
end
# Avoid creating empty samples
# ip == 0x0 is the sentinel value for finishing a backtrace (when meta is disabled), therefore finising a sample
# On some platforms, we sometimes get two 0s in a row for some reason...
Expand Down Expand Up @@ -274,10 +279,8 @@ function pprof(data::Union{Nothing, Vector{UInt}} = nothing,
end
file = Base.find_source_file(file)
filename = enter!(file)
# Only keep C functions if from_c=true
if (from_c || !frame.from_c)
funcs[func_id] = Function(func_id, name, system_name, filename, start_line)
end
# Decode C functions always
funcs[func_id] = Function(func_id, name, system_name, filename, start_line)
end
locs_from_c[ip] = location_from_c
# Only keep C frames if from_c=true
Expand Down
2 changes: 1 addition & 1 deletion test/PProf.jl
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ end
# Test that C frames were excluded
@test length(with_c.sample) == length(without_c.sample)
@test length(with_c.location) > length(without_c.location)
@test length(with_c.var"#function") > length(without_c.var"#function")
@test length(with_c.var"#function") == length(without_c.var"#function")
end
end

Expand Down
Loading