Hi, I'm trying to profile a simple code I wrote that has just two functions. When I call Profile.print() I get a lot of detail about modules that (at least at this point) I'm not interested in profiling (in this case, for example the Primes module, and the REPL itself).
,---- | julia> Profile.print() | 97 ./event.jl:68; (::Base.REPL.##3#4{Base.REPL.REPLBackend})() | 97 ./REPL.jl:95; macro expansion | 97 ./REPL.jl:64; eval_user_input(::Any, ::Base.REPL.REPLBackend) | 97 ./boot.jl:234; eval(::Module, ::Any) | 97 ./<missing>:?; anonymous | 97 ./profile.jl:16; macro expansion; | 69 /home/angelv/temp/p21.jl:8; p21(::Int64) | 1 /home/angelv/temp/p21.jl:0; sumfactors(::Int64) | 1 /home/angelv/temp/p21.jl:23; sumfactors(::Int64) | 1 ./abstractarray.jl:21; vect(::Int64, ::Vararg{Int64,N}) | 49 /home/angelv/temp/p21.jl:24; sumfactors(::Int64) | 1 ...v/.julia/v0.5/Primes/src/Primes.jl:246; factor!(::Int64, ::Dict{Int64,Int64}) | 1 ...v/.julia/v0.5/Primes/src/Primes.jl:154; isprime(::Int64) | 1 ...v/.julia/v0.5/Primes/src/Primes.jl:213; witnesses(::Int64) | 1 .../.julia/v0.5/Primes/src/Primes.jl:210; _witnesses(::UInt64) | 1 ...v/.julia/v0.5/Primes/src/Primes.jl:252; factor!(::Int64, ::Dict{Int64,Int64}) | 1 ...v/.julia/v0.5/Primes/src/Primes.jl:254; factor!(::Int64, ::Dict{Int64,Int64}) | 1 ./dict.jl:692; get | ... `---- I think it would be nice to have three more options to the Profile.print function, which should not be difficult to implement: 1. to print percentages 2. to limit the output based on a list of regex 3. to be able to select the number of spaces added at each indentation level So, for example, I could make a call like julia> Profile.print(consider=[r"/home/angelv/temp]",percentage=true,indent=3) 71.10% 69 /home/angelv/temp/p21.jl:8; p21(::Int64) 01.00% 1 /home/angelv/temp/p21.jl:0; sumfactors(::Int64) 01.00% 1 /home/angelv/temp/p21.jl:23; sumfactors(::Int64) 50.50% 49 /home/angelv/temp/p21.jl:24; sumfactors(::Int64) 18.60% 18 /home/angelv/temp/p21.jl:25; sumfactors(::Int64) 28.90% 28 /home/angelv/temp/p21.jl:11; p21(::Int64) 19.60% 19 /home/angelv/temp/p21.jl:24; sumfactors(::Int64) 06.20% 6 /home/angelv/temp/p21.jl:25; sumfactors(::Int64) 01.00% 1 /home/angelv/temp/p21.jl:27; sumfactors(::Int64) This would make reading the profile data much simpler for when you are developing new code and are not interested in profiling other modules. Is this reasonable? Could this be implemented? (My proficiency with Julia is very basic right now, but if this is considered a useful addition, I could try to contribute with changes to profile.jl) Cheers, -- Ángel de Vicente http://www.iac.es/galeria/angelv/