Skip to content

Commit ec8aa60

Browse files
shorten C paths that are from src and usr/lib
1 parent 99bab1b commit ec8aa60

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

stdlib/Profile/src/Profile.jl

+10-1
Original file line numberDiff line numberDiff line change
@@ -503,13 +503,22 @@ function flatten(data::Vector, lidict::LineInfoDict)
503503
return (newdata, newdict)
504504
end
505505

506+
const SRC_DIR = normpath(joinpath(Sys.BUILD_ROOT_PATH, "src"))
507+
const LIB_DIR = normpath(joinpath(Sys.BUILD_ROOT_PATH, "usr", "lib"))
508+
506509
# Take a file-system path and try to form a concise representation of it
507510
# based on the package ecosystem
508511
function short_path(spath::Symbol, filenamecache::Dict{Symbol, Tuple{String,String,String}})
509512
return get!(filenamecache, spath) do
510513
path = Base.fixup_stdlib_path(string(spath))
511514
possible_base_path = normpath(joinpath(Sys.BINDIR, Base.DATAROOTDIR, "julia", "base", path))
512-
if isabspath(path)
515+
if startswith(path, SRC_DIR)
516+
remainder = only(split(path, SRC_DIR, keepempty=false))
517+
return (isfile(path) ? path : ""), "@src", remainder
518+
elseif startswith(path, LIB_DIR)
519+
remainder = only(split(path, LIB_DIR, keepempty=false))
520+
return (isfile(path) ? path : ""), "@lib", remainder
521+
elseif isabspath(path)
513522
if ispath(path)
514523
# try to replace the file-system prefix with a short "@Module" one,
515524
# assuming that profile came from the current machine

0 commit comments

Comments
 (0)