Skip to content
Permalink

Comparing changes

This is a direct comparison between two commits made in this repository or its related repositories. View the default comparison for this range or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: JuliaLang/julia
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 071fb8391d17dd856c5eb209e224a7ea4b8d7a26
Choose a base ref
..
head repository: JuliaLang/julia
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 2fccb63bb50b8f1e32f62cc2df86eeddd99e3c00
Choose a head ref
Showing with 6 additions and 5 deletions.
  1. +6 −5 stdlib/Profile/src/Profile.jl
11 changes: 6 additions & 5 deletions stdlib/Profile/src/Profile.jl
Original file line number Diff line number Diff line change
@@ -263,7 +263,7 @@ end
function get_task_ids(data::Vector{<:Unsigned}, threadid = nothing)
taskids = UInt[]
for i in length(data):-1:1
if i > 1 && is_block_end(data, i)
if is_block_end(data, i)
if isnothing(threadid) || data[i - 4] == threadid
taskid = data[i - 3]
!in(taskid, taskids) && push!(taskids, taskid)
@@ -276,7 +276,7 @@ end
function get_thread_ids(data::Vector{<:Unsigned}, taskid = nothing)
threadids = Int[]
for i in length(data):-1:1
if i > 1 && is_block_end(data, i)
if is_block_end(data, i)
if isnothing(taskid) || data[i - 3] == taskid
threadid = data[i - 4]
!in(threadid, threadids) && push!(threadids, threadid)
@@ -287,6 +287,7 @@ function get_thread_ids(data::Vector{<:Unsigned}, taskid = nothing)
end

function is_block_end(data, i)
i < 2 && return false
# 32-bit linux has been seen to have rogue ips equal to 0 so we cannot just rely on zeros being the block end.
# Also check for the previous entry looking like an idle state metadata entry which can only be 1 or 2
return data[i] == 0 && in(data[i - 1], [1,2])
@@ -525,7 +526,7 @@ function fetch(;include_meta = false)
i = length(data)
while i > 0 && j > 0
data_stripped[j] = data[i]
if i > 1 && is_block_end(data, i)
if is_block_end(data, i)
i -= nmeta
end
i -= 1
@@ -555,7 +556,7 @@ function parse_flat(::Type{T}, data::Vector{UInt64}, lidict::Union{LineInfoDict,
for i in startframe:-1:1
startframe - 1 <= i <= startframe - 4 && continue # skip metadata (it's read ahead below)
ip = data[i]
if i > 1 && is_block_end(data, i)
if is_block_end(data, i)
# read metadata
thread_sleeping = data[i - 1] - 1 # subtract 1 as state is incremented to avoid being equal to 0
# cpu_cycle_clock = data[i - 2]
@@ -803,7 +804,7 @@ function tree!(root::StackFrameTree{T}, all::Vector{UInt64}, lidict::Union{LineI
for i in startframe:-1:1
startframe - 1 <= i <= startframe - 4 && continue # skip metadata (its read ahead below)
ip = all[i]
if i > 1 && is_block_end(all, i)
if is_block_end(all, i)
# read metadata
thread_sleeping = all[i - 1] - 1 # subtract 1 as state is incremented to avoid being equal to 0
# cpu_cycle_clock = all[i - 2]