@@ -980,14 +980,13 @@ mutable struct StackFrameTree{T} # where T <: Union{UInt64, StackFrame}
980
980
flat_count:: Int # number of times this frame was in the flattened representation (unlike count, this'll sum to 100% of parent)
981
981
max_recur:: Int # maximum number of times this frame was the *top* of the recursion in the stack
982
982
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
984
983
down:: Dict{T, StackFrameTree{T}}
985
984
# construction workers:
986
985
recur:: Int
987
986
builder_key:: Vector{UInt64}
988
987
builder_value:: Vector{StackFrameTree{T}}
989
988
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}[])
991
990
end
992
991
993
992
@@ -1028,10 +1027,6 @@ function tree_format(frames::Vector{<:StackFrameTree}, level::Int, cols::Int, ma
1028
1027
base = string (base, " +" , nextra, " " )
1029
1028
end
1030
1029
strcount = rpad (string (frame. count), ndigcounts, " " )
1031
- if frame. sleeping
1032
- stroverhead = styled " {gray:$(stroverhead)}"
1033
- strcount = styled " {gray:$(strcount)}"
1034
- end
1035
1030
if li != UNKNOWN
1036
1031
if li. line == li. pointer
1037
1032
strs[i] = string (stroverhead, " ╎" , base, strcount, " " ,
@@ -1044,7 +1039,6 @@ function tree_format(frames::Vector{<:StackFrameTree}, level::Int, cols::Int, ma
1044
1039
else
1045
1040
fname = string (li. func)
1046
1041
end
1047
- frame. sleeping && (fname = styled " {gray:$(fname)}" )
1048
1042
path, pkgname, filename = short_path (li. file, filenamemap)
1049
1043
if showpointer
1050
1044
fname = string (
@@ -1088,15 +1082,15 @@ function tree!(root::StackFrameTree{T}, all::Vector{UInt64}, lidict::Union{LineI
1088
1082
skip = false
1089
1083
nsleeping = 0
1090
1084
is_task_profile = false
1091
- is_sleeping = true
1092
1085
for i in startframe: - 1 : 1
1093
1086
(startframe - 1 ) >= i >= (startframe - (nmeta + 1 )) && continue # skip metadata (it's read ahead below) and extra block end NULL IP
1094
1087
ip = all[i]
1095
1088
if is_block_end (all, i)
1096
1089
# read metadata
1097
1090
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
1100
1094
# cpu_cycle_clock = all[i - META_OFFSET_CPUCYCLECLOCK]
1101
1095
taskid = all[i - META_OFFSET_TASKID]
1102
1096
threadid = all[i - META_OFFSET_THREADID]
@@ -1151,7 +1145,6 @@ function tree!(root::StackFrameTree{T}, all::Vector{UInt64}, lidict::Union{LineI
1151
1145
parent = build[j]
1152
1146
parent. recur += 1
1153
1147
parent. count_recur += 1
1154
- parent. sleeping &= is_sleeping
1155
1148
found = true
1156
1149
break
1157
1150
end
@@ -1171,7 +1164,6 @@ function tree!(root::StackFrameTree{T}, all::Vector{UInt64}, lidict::Union{LineI
1171
1164
while this != = parent && (recur === :off || this. recur == 0 )
1172
1165
this. count += 1
1173
1166
this. recur = 1
1174
- this. sleeping &= is_sleeping
1175
1167
this = this. up
1176
1168
end
1177
1169
end
@@ -1193,7 +1185,6 @@ function tree!(root::StackFrameTree{T}, all::Vector{UInt64}, lidict::Union{LineI
1193
1185
this. up = parent
1194
1186
this. count += 1
1195
1187
this. recur = 1
1196
- this. sleeping &= is_sleeping
1197
1188
end
1198
1189
parent = this
1199
1190
end
@@ -1338,6 +1329,23 @@ function callersf(matchfunc::Function, bt::Vector, lidict::LineInfoFlatDict)
1338
1329
end
1339
1330
1340
1331
# # 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)
1341
1349
1342
1350
# Order alphabetically (file, function) and then by line number
1343
1351
function liperm (lilist:: Vector{StackFrame} )
0 commit comments