Profiling and line numbers

Hello

I was looking to find where our code spends all its time, and tried Profile.print(). It gave me a few thousand lines of output. I am sure the answer to my query is in there, but I don’t know where to start looking for the lines that take all the time.

I see there are wonderful graphical ways to process this, but I am stuck on the command line, with no graphics.

So my question. Can anyone tell me how to find out from Profile.print() which lines my code is spending all its time.

Thanks
js

try out profileviews.jl it turns it into a graph which is way easier to interpret.

1 Like

I always do Profile.print(mincount=1000) (for some value of 1000) which prunes the tree to the most costly lines.

Would be neat if there were an in-terminal way to view the profile as a flame graph, or interact with the tree.

3 Likes

Thats nice! But sadly can only see graph only on my laptop and not the machine I need to run it on, which has no gui. A bit hard to map the mountain peak to a particular code line below though.

thanks js

yes, cuts down on the lines, thanks.

not being an expert, seems like grepping this for my file names is the way to find where my code spends its time. But that seems so obvious it cannot be correct.

Does PProf.jl help?

If your laptop is able to access the port PProf serves on, you could use it directly.

If not, you can pass web = false and download the .pb.gz file to your laptop, to open with a local pprof.

1 Like

Of course, can use ssh port forwarding with PProf. Very nice, thanks.

Tried it, and it works like a charm over ssh. Thanks @digital_carver, and it looks super nice.

js

1 Like