Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Profile: use full terminal cols to show function name #53055

Merged
merged 2 commits into from
Jan 25, 2024

Conversation

IanButterworth
Copy link
Sponsor Member

@IanButterworth IanButterworth commented Jan 25, 2024

Currently the function printing is truncated shorter than it needs to be, and uses ... rather than the single char

------------------------------------terminal width----------------------------------------------->|
julia> Profile.print()
Overhead ╎ [+additional indent] Count File:Line; Function
=========================================================
    ╎50   @Base/client.jl:535; _start()
    ╎ 50   @Base/client.jl:561; repl_main
    ╎  50   @Base/client.jl:424; run_main_repl(interactive::Bool, quiet::...
    ╎   50   @Base/essentials.jl:1017; invokelatest
    ╎    50   @Base/essentials.jl:1020; #invokelatest#2
    ╎     50   @Base/client.jl:440; (::Base.var"#1096#1098"{Bool, Symbol, B...
    ╎    ╎ 50   @REPL/src/REPL.jl:447; run_repl(repl::REPL.AbstractREPL, cons...
    ╎    ╎  50   @REPL/src/REPL.jl:461; run_repl(repl::REPL.AbstractREPL, con...
    ╎    ╎   50   @REPL/src/REPL.jl:302; kwcall(::NamedTuple, ::typeof(REPL.st...
    ╎    ╎    50   @REPL/src/REPL.jl:305; start_repl_backend(backend::REPL.REP...
    ╎    ╎     50   @REPL/src/REPL.jl:320; repl_backend_loop(backend::REPL.REPL...
    ╎    ╎    ╎ 50   @REPL/src/REPL.jl:224; eval_user_input(ast::Any, backend::...
   1╎    ╎    ╎  50   @Base/boot.jl:428; eval
    ╎    ╎    ╎   49   ...c/InteractiveUtils.jl:333; peakflops()
    ╎    ╎    ╎    49   ...c/InteractiveUtils.jl:333; peakflops
    ╎    ╎    ╎     49   ...c/InteractiveUtils.jl:338; peakflops(n::Int64; eltype::DataT...

This PR

------------------------------------terminal width----------------------------------------------->|
julia> Profile.print()
Overhead ╎ [+additional indent] Count File:Line; Function
=========================================================
    ╎50   @Base/client.jl:535; _start()
    ╎ 50   @Base/client.jl:561; repl_main
    ╎  50   @Base/client.jl:424; run_main_repl(interactive::Bool, quiet::Bool, banner::Symbol, hi…
    ╎   50   @Base/essentials.jl:1017; invokelatest
    ╎    50   @Base/essentials.jl:1020; #invokelatest#2
    ╎     50   @Base/client.jl:440; (::Base.var"#1096#1098"{Bool, Symbol, Bool})(REPL::Module)
    ╎    ╎ 50   @REPL/src/REPL.jl:447; run_repl(repl::REPL.AbstractREPL, consumer::Any)
    ╎    ╎  50   @REPL/src/REPL.jl:461; run_repl(repl::REPL.AbstractREPL, consumer::Any; backend_…
    ╎    ╎   50   @REPL/src/REPL.jl:302; kwcall(::NamedTuple, ::typeof(REPL.start_repl_backend), …
    ╎    ╎    50   @REPL/src/REPL.jl:305; start_repl_backend(backend::REPL.REPLBackend, consumer:…
    ╎    ╎     50   @REPL/src/REPL.jl:320; repl_backend_loop(backend::REPL.REPLBackend, get_modul…
    ╎    ╎    ╎ 50   @REPL/src/REPL.jl:224; eval_user_input(ast::Any, backend::REPL.REPLBackend, …
   1╎    ╎    ╎  50   @Base/boot.jl:428; eval
    ╎    ╎    ╎   49   …src/InteractiveUtils.jl:333; peakflops()
    ╎    ╎    ╎    49   …src/InteractiveUtils.jl:333; peakflops
    ╎    ╎    ╎     49   …src/InteractiveUtils.jl:338; peakflops(n::Int64; eltype::DataType, ntri…

@IanButterworth IanButterworth added profiler backport 1.10 Change should be backported to the 1.10 release labels Jan 25, 2024
Copy link
Sponsor Member

@vtjnash vtjnash left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

SGTM. Left a comment for a followup improvement

@vtjnash vtjnash added the status:merge me PR is reviewed. Merge when all tests are passing label Jan 25, 2024
return str
else
return string("...", str[prevind(str, end, w-4):end])
return string("", str[prevind(str, end, w-2):end])
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This won't work right with composites, will it? But of course that's an existing issue with the code; and one might argue that usually it won't matter in this context. Unless someone heavily uses accents in function names perhaps?

I.e., compare this:

julia> s = "áb"  # input via ""a\acute<TAB>b""
"áb"

julia> collect(s)
3-element Vector{Char}:
 'a': ASCII/Unicode U+0061 (category Ll: Letter, lowercase)
 '́': Unicode U+0301 (category Mn: Mark, nonspacing)
 'b': ASCII/Unicode U+0062 (category Ll: Letter, lowercase)

julia> using Unicode

julia> collect(Unicode.graphemes(s))
2-element Vector{SubString{String}}:
 "á"
 "b"

Anyway, don't take this as an objection to this PR from me -- this issue will never affect me, I only ever use ASCII function names, so I don't mind either way ;-)

@IanButterworth IanButterworth merged commit 4919dd7 into JuliaLang:master Jan 25, 2024
7 checks passed
@IanButterworth IanButterworth deleted the ib/profile_trunc branch January 25, 2024 19:50
@IanButterworth IanButterworth removed the status:merge me PR is reviewed. Merge when all tests are passing label Jan 25, 2024
IanButterworth added a commit that referenced this pull request Jan 26, 2024
@IanButterworth IanButterworth mentioned this pull request Jan 26, 2024
33 tasks
@IanButterworth IanButterworth removed the backport 1.10 Change should be backported to the 1.10 release label Jan 26, 2024
KristofferC added a commit that referenced this pull request Feb 6, 2024
Backported PRs:
- [x] #51095 <!-- Fix edge cases where inexact conversions to UInt don't
throw -->
- [x] #52583 <!-- Don't access parent of triangular matrix in powm -->
- [x] #52645 <!-- update --gcthreads section in command line options -->
- [x] #52423 <!-- update nthreads info in versioninfo -->
- [x] #52721 <!-- inference: Guard TypeVar special case against vararg
-->
- [x] #52637 <!-- fix finding bundled stdlibs even if they are e.g.
devved in an environment higher in the load path -->
- [x] #52752 <!-- staticdata: handle cycles in datatypes -->
- [x] #52758 <!-- use a Dict instead of an IdDict for caching of the
`cwstring` for Windows env variables -->
- [x] #51375 <!-- Insert hardcoded backlinks to stdlib doc pages -->
- [x] #52994 <!-- place work-stealing queue indices on different cache
lines to avoid false-sharing -->
- [x] #53015 <!-- Add type assertion in iterate for logicalindex -->
- [x] #53032 <!-- Fix a list in GC devdocs -->
- [x] #52748 
- [x] #52856 
- [x] #52878
- [x] #52754 
- [x] #52228
- [x] #52924
- [x] #52569 <!-- Fix GC rooting during rehashing of iddict -->
- [x] #52605 <!-- Default uplo in symmetric/hermitian -->
- [x] #52618 <!-- heap snapshot: add gc roots and gc finalist roots to
fix unrooted nodes -->
- [x] #52781 <!-- fix type-stability bugs in Ryu code -->
- [x] #53055 <!-- Profile: use full terminal cols to show function name
-->
- [x] #53096 
- [x] #53076 
- [x] #52841 <!-- Extensions: make loading of extensions independent of
what packages are in the sysimage -->
- [x] #52078 <!-- Replace `&hArr;` by `&harr;` in documentation -->
- [x] #53035 <!-- use proper cache-line size variable in work-stealing
queue -->
- [x] #53066 <!-- doc: replace harr HTML entity by unicode -->
- [x] #52996 <!-- Apple silicon has 128 byte alignment so fix our
defines to match -->
- [x] #53121 

Non-merged PRs with backport label:
- [ ] #52694 <!-- Reinstate similar for AbstractQ for backward
compatibility -->
- [ ] #51479 <!-- prevent code loading from lookin in the versioned
environment when building Julia -->
Drvi pushed a commit to RelationalAI/julia that referenced this pull request Jun 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants