Skip to content

Commit 9c997fe

Browse files
committed
Revert "Profile.print: de-focus sleeping frames as gray (#57312)"
This reverts commit 132057c.
1 parent c3c8f9e commit 9c997fe

File tree

1 file changed

+21
-13
lines changed

1 file changed

+21
-13
lines changed

stdlib/Profile/src/Profile.jl

Lines changed: 21 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -980,14 +980,13 @@ mutable struct StackFrameTree{T} # where T <: Union{UInt64, StackFrame}
980980
flat_count::Int # number of times this frame was in the flattened representation (unlike count, this'll sum to 100% of parent)
981981
max_recur::Int # maximum number of times this frame was the *top* of the recursion in the stack
982982
count_recur::Int # sum of the number of times this frame was the *top* of the recursion in a stack (divide by count to get an average)
983-
sleeping::Bool # whether this frame was in a sleeping state
984983
down::Dict{T, StackFrameTree{T}}
985984
# construction workers:
986985
recur::Int
987986
builder_key::Vector{UInt64}
988987
builder_value::Vector{StackFrameTree{T}}
989988
up::StackFrameTree{T}
990-
StackFrameTree{T}() where {T} = new(UNKNOWN, 0, 0, 0, 0, 0, true, Dict{T, StackFrameTree{T}}(), 0, UInt64[], StackFrameTree{T}[])
989+
StackFrameTree{T}() where {T} = new(UNKNOWN, 0, 0, 0, 0, 0, Dict{T, StackFrameTree{T}}(), 0, UInt64[], StackFrameTree{T}[])
991990
end
992991

993992

@@ -1028,10 +1027,6 @@ function tree_format(frames::Vector{<:StackFrameTree}, level::Int, cols::Int, ma
10281027
base = string(base, "+", nextra, " ")
10291028
end
10301029
strcount = rpad(string(frame.count), ndigcounts, " ")
1031-
if frame.sleeping
1032-
stroverhead = styled"{gray:$(stroverhead)}"
1033-
strcount = styled"{gray:$(strcount)}"
1034-
end
10351030
if li != UNKNOWN
10361031
if li.line == li.pointer
10371032
strs[i] = string(stroverhead, "", base, strcount, " ",
@@ -1044,7 +1039,6 @@ function tree_format(frames::Vector{<:StackFrameTree}, level::Int, cols::Int, ma
10441039
else
10451040
fname = string(li.func)
10461041
end
1047-
frame.sleeping && (fname = styled"{gray:$(fname)}")
10481042
path, pkgname, filename = short_path(li.file, filenamemap)
10491043
if showpointer
10501044
fname = string(
@@ -1088,15 +1082,15 @@ function tree!(root::StackFrameTree{T}, all::Vector{UInt64}, lidict::Union{LineI
10881082
skip = false
10891083
nsleeping = 0
10901084
is_task_profile = false
1091-
is_sleeping = true
10921085
for i in startframe:-1:1
10931086
(startframe - 1) >= i >= (startframe - (nmeta + 1)) && continue # skip metadata (it's read ahead below) and extra block end NULL IP
10941087
ip = all[i]
10951088
if is_block_end(all, i)
10961089
# read metadata
10971090
thread_sleeping_state = all[i - META_OFFSET_SLEEPSTATE] - 1 # subtract 1 as state is incremented to avoid being equal to 0
1098-
is_sleeping = thread_sleeping_state == 1
1099-
is_task_profile = thread_sleeping_state == 2
1091+
if thread_sleeping_state == 2
1092+
is_task_profile = true
1093+
end
11001094
# cpu_cycle_clock = all[i - META_OFFSET_CPUCYCLECLOCK]
11011095
taskid = all[i - META_OFFSET_TASKID]
11021096
threadid = all[i - META_OFFSET_THREADID]
@@ -1151,7 +1145,6 @@ function tree!(root::StackFrameTree{T}, all::Vector{UInt64}, lidict::Union{LineI
11511145
parent = build[j]
11521146
parent.recur += 1
11531147
parent.count_recur += 1
1154-
parent.sleeping &= is_sleeping
11551148
found = true
11561149
break
11571150
end
@@ -1171,7 +1164,6 @@ function tree!(root::StackFrameTree{T}, all::Vector{UInt64}, lidict::Union{LineI
11711164
while this !== parent && (recur === :off || this.recur == 0)
11721165
this.count += 1
11731166
this.recur = 1
1174-
this.sleeping &= is_sleeping
11751167
this = this.up
11761168
end
11771169
end
@@ -1193,7 +1185,6 @@ function tree!(root::StackFrameTree{T}, all::Vector{UInt64}, lidict::Union{LineI
11931185
this.up = parent
11941186
this.count += 1
11951187
this.recur = 1
1196-
this.sleeping &= is_sleeping
11971188
end
11981189
parent = this
11991190
end
@@ -1338,6 +1329,23 @@ function callersf(matchfunc::Function, bt::Vector, lidict::LineInfoFlatDict)
13381329
end
13391330

13401331
## Utilities
1332+
function rtruncto(str::String, w::Int)
1333+
if textwidth(str) <= w
1334+
return str
1335+
else
1336+
return string("", str[prevind(str, end, w-2):end])
1337+
end
1338+
end
1339+
function ltruncto(str::String, w::Int)
1340+
if textwidth(str) <= w
1341+
return str
1342+
else
1343+
return string(str[1:nextind(str, 1, w-2)], "")
1344+
end
1345+
end
1346+
1347+
1348+
truncto(str::Symbol, w::Int) = truncto(string(str), w)
13411349

13421350
# Order alphabetically (file, function) and then by line number
13431351
function liperm(lilist::Vector{StackFrame})

0 commit comments

Comments
 (0)