Skip to content

Commit

Permalink
Modify whos()
Browse files Browse the repository at this point in the history
  • Loading branch information
malmaud committed Jan 12, 2017
1 parent 0559a2e commit 0f38766
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions base/interactiveutil.jl
Original file line number Diff line number Diff line change
Expand Up @@ -667,7 +667,7 @@ Print information about exported global variables in a module, optionally restri
The memory consumption estimate is an approximate lower bound on the size of the internal structure of the object.
"""
function whos(io::IO=STDOUT, m::Module=current_module(), pattern::Regex=r"^(?!.*(Base|Main|Core)).*$")
function whos(io::IO=STDOUT, m::Module=current_module(), pattern::Regex=r"")
maxline = displaysize(io)[2]
line = zeros(UInt8, maxline)
head = PipeBuffer(maxline + 1)
Expand All @@ -677,17 +677,20 @@ function whos(io::IO=STDOUT, m::Module=current_module(), pattern::Regex=r"^(?!.*
value = getfield(m, v)
@printf head "%30s " s
try
bytes = summarysize(value)
if bytes < 10_000
@printf(head, "%6d bytes ", bytes)
if s ("Base", "Main", "Core")
print(head, " ")
else
@printf(head, "%6d KB ", bytes ÷ (1024))
bytes = summarysize(value)
if bytes < 10_000
@printf(head, "%6d bytes ", bytes)
else
@printf(head, "%6d KB ", bytes ÷ (1024))
end
end
print(head, summary(value))
catch e
print(head, "#=ERROR: unable to show value=#")
end

newline = search(head, UInt8('\n')) - 1
if newline < 0
newline = nb_available(head)
Expand Down

0 comments on commit 0f38766

Please sign in to comment.