Skip to content

Commit 1172dc0

Browse files
IanButterworthKristofferC
authored and
KristofferC
committed
Profile.print: color Base/Core & packages. Make paths clickable (#55335)
Updated ## This PR ![Screenshot 2024-09-02 at 1 47 23 PM](https://github.com/user-attachments/assets/1264e623-70b2-462a-a595-1db2985caf64) ## master ![Screenshot 2024-09-02 at 1 49 42 PM](https://github.com/user-attachments/assets/14d62fe1-c317-4df5-86e9-7c555f9ab6f1) Todo: - [ ] ~Maybe drop the `@` prefix when coloring it, given it's obviously special when colored~ If someone copy-pasted the profile into an issue this would make it confusing. - [ ] Figure out why `Profile.print(format=:flat)` is truncating before the terminal width is used up - [x] Make filepaths terminal links (even if they're truncated)
1 parent bb2abb5 commit 1172dc0

File tree

5 files changed

+113
-64
lines changed

5 files changed

+113
-64
lines changed

NEWS.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,9 @@ Standard library changes
138138
* `Profile.take_heap_snapshot` takes a new keyword argument, `redact_data::Bool`,
139139
that is `true` by default. When set, the contents of Julia objects are not emitted
140140
in the heap snapshot. This currently only applies to strings. ([#55326])
141+
* `Profile.print()` now colors Base/Core/Package modules similarly to how they are in stacktraces.
142+
Also paths, even if truncated, are now clickable in terminals that support URI links
143+
to take you to the specified `JULIA_EDITOR` for the given file & line number. ([#55335])
141144

142145
#### Random
143146

stdlib/Manifest.toml

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -68,12 +68,12 @@ version = "1.11.0"
6868
[[deps.JuliaSyntaxHighlighting]]
6969
deps = ["StyledStrings"]
7070
uuid = "dc6e5ff7-fb65-4e79-a425-ec3bc9c03011"
71-
version = "1.11.0"
71+
version = "1.12.0"
7272

7373
[[deps.LLD_jll]]
7474
deps = ["Artifacts", "Libdl", "Zlib_jll", "libLLVM_jll"]
7575
uuid = "d55e3150-da41-5e91-b323-ecfd1eec6109"
76-
version = "16.0.6+4"
76+
version = "18.1.7+2"
7777

7878
[[deps.LLVMLibUnwind_jll]]
7979
deps = ["Artifacts", "Libdl"]
@@ -113,12 +113,12 @@ version = "1.11.0+1"
113113
[[deps.LibUV_jll]]
114114
deps = ["Artifacts", "Libdl"]
115115
uuid = "183b4373-6708-53ba-ad28-60e28bb38547"
116-
version = "2.0.1+16"
116+
version = "2.0.1+17"
117117

118118
[[deps.LibUnwind_jll]]
119119
deps = ["Artifacts", "Libdl"]
120120
uuid = "745a5e78-f969-53e9-954f-d19f2f74f4e3"
121-
version = "1.8.1+0"
121+
version = "1.8.1+1"
122122

123123
[[deps.Libdl]]
124124
uuid = "8f399da3-3557-5675-b5ff-fb832c97cbdb"
@@ -163,7 +163,7 @@ version = "1.2.0"
163163
[[deps.OpenBLAS_jll]]
164164
deps = ["Artifacts", "CompilerSupportLibraries_jll", "Libdl"]
165165
uuid = "4536629a-c528-5b80-bd46-f80d51c5b363"
166-
version = "0.3.26+2"
166+
version = "0.3.28+2"
167167

168168
[[deps.OpenLibm_jll]]
169169
deps = ["Artifacts", "Libdl"]
@@ -190,6 +190,7 @@ uuid = "de0858da-6303-5e67-8744-51eddeeeb8d7"
190190
version = "1.11.0"
191191

192192
[[deps.Profile]]
193+
deps = ["StyledStrings"]
193194
uuid = "9abbd945-dff8-562f-b5e8-e1ebf5ef1b79"
194195
version = "1.11.0"
195196

@@ -223,7 +224,7 @@ version = "1.11.0"
223224
[[deps.SparseArrays]]
224225
deps = ["Libdl", "LinearAlgebra", "Random", "Serialization", "SuiteSparse_jll"]
225226
uuid = "2f01184e-e22b-5df5-ae63-d93ebab69eaf"
226-
version = "1.11.0"
227+
version = "1.12.0"
227228

228229
[[deps.Statistics]]
229230
deps = ["LinearAlgebra"]
@@ -242,7 +243,7 @@ version = "1.11.0"
242243
[[deps.SuiteSparse_jll]]
243244
deps = ["Artifacts", "Libdl", "libblastrampoline_jll"]
244245
uuid = "bea87d4a-7f5b-5778-9afe-8cc45184846c"
245-
version = "7.7.0+0"
246+
version = "7.8.0+0"
246247

247248
[[deps.TOML]]
248249
deps = ["Dates"]
@@ -281,12 +282,12 @@ version = "2.2.5+0"
281282
[[deps.libLLVM_jll]]
282283
deps = ["Artifacts", "Libdl"]
283284
uuid = "8f36deef-c2a5-5394-99ed-8e07531fb29a"
284-
version = "16.0.6+4"
285+
version = "18.1.7+2"
285286

286287
[[deps.libblastrampoline_jll]]
287288
deps = ["Artifacts", "Libdl"]
288289
uuid = "8e850b90-86db-534c-a0d3-1478176c7d93"
289-
version = "5.8.0+1"
290+
version = "5.11.0+0"
290291

291292
[[deps.nghttp2_jll]]
292293
deps = ["Artifacts", "Libdl"]

stdlib/Profile/Project.toml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,12 @@ name = "Profile"
22
uuid = "9abbd945-dff8-562f-b5e8-e1ebf5ef1b79"
33
version = "1.11.0"
44

5+
[deps]
6+
StyledStrings = "f489334b-da3d-4c2e-b8f0-e476e12c162b"
7+
8+
[compat]
9+
StyledStrings = "1.11.0"
10+
511
[extras]
612
Base64 = "2a0f44e3-6c83-55bd-87e4-b1978d98bd5f"
713
Logging = "56ddb016-857b-54e1-b83d-db4d58db5568"

stdlib/Profile/src/Allocs.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -321,7 +321,7 @@ end
321321
function flat(io::IO, data::Vector{Alloc}, cols::Int, fmt::ProfileFormat)
322322
fmt.combine || error(ArgumentError("combine=false"))
323323
lilist, n, m, totalbytes = parse_flat(fmt.combine ? StackFrame : UInt64, data, fmt.C)
324-
filenamemap = Dict{Symbol,String}()
324+
filenamemap = Profile.FileNameMap()
325325
if isempty(lilist)
326326
warning_empty()
327327
return true

0 commit comments

Comments
 (0)