# About PProf

**URL:** <https://discourse.julialang.org/t/about-pprof/93456>\
**Category:** Profiling\
**Created:** [January 24, 2023, 11:42am UTC](https://discourse.julialang.org/t/about-pprof/93456 "2023-01-24T11:42:08Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![Kristin](https://avatars.discourse-cdn.com/v4/letter/k/2bfe46/32.png) [@Kristin](https://discourse.julialang.org/u/Kristin)\
**Post date:** [January 24, 2023, 11:42am UTC](https://discourse.julialang.org/t/about-pprof/93456/1 "2023-01-24T11:42:08Z")

</div>

Dear there,  
I’ve a quick question about PProf. I’m using Julia 1.8.4, and I’m learning the new profile tool. So I follow a simple example as below. I first define a function:

```julia
function myfunc()
       A = rand(200, 200, 400)
       maximum(A)
end

```

Then run `@time Profile.Allocs.@profile sample_rate=1 myfunc()`. Then `PProf.Allocs.pprof(from_c = false)`. And it creats “alloc-profile.pb.gz” as expect, and a web link [http://localhost:62261](http://localhost:62261). But the problem is I can’t open this link in any browsers (I’ve tried safari, google chrome and firefox). Do you happen to know how to solve this?

Thank you so much and happy new year!!

---

<div class="post-metadata">

**Author:** ![stepanzh](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/stepanzh/32/34851_2.png) [@stepanzh](https://discourse.julialang.org/u/stepanzh)\
**Post date:** [January 24, 2023, 12:57pm UTC](https://discourse.julialang.org/t/about-pprof/93456/2 "2023-01-24T12:57:45Z")

</div>

Hi, Kristin! Do you work in Julia’s REPL? Last time I used PProf, it seemed that a user has to stay in the REPL, because PProf creates a temporary server for viewing the “alloc-profile.pg.gz”. Exiting the REPL shutdowns the server.

Another option is to examine pprof data using [pprof](https://github.com/google/pprof) utility.

---

<div class="post-metadata">

**Author:** ![Kristin](https://avatars.discourse-cdn.com/v4/letter/k/2bfe46/32.png) [@Kristin](https://discourse.julialang.org/u/Kristin)\
**Post date:** [January 25, 2023, 12:44am UTC](https://discourse.julialang.org/t/about-pprof/93456/3 "2023-01-25T00:44:50Z")

</div>

Thanks for your reply! Yes I’m in Julia’s REPL. I run julia on a cluster, and I got the following web link, then I copy and paste to a browsers but can’t open it…  
 ![Screen Shot 2023-01-24 at 4.37.16 PM](https://global.discourse-cdn.com/julialang/original/3X/0/c/0c6daff50c1971eac600c5798be7d0f0b4db6179.png)

And I just install pprof, but when I run `pprof -web [main_binary] ./alloc-profile.pb.gz`, I got error message:  
**[main\_binary]: open [main\_binary]: no such file or directory**  
**Fetched 1 source profiles out of 2**  
**Main binary filename not available.**  
**pprof: exec: “sensible-browser”: executable file not found in $PATH**

I feel it’s because I’m running this on a remote shell so I don’t have a browser there, but I’m not sure how to solve this…Could you give me some suggestion? Thank you!!

---

<div class="post-metadata">

**Author:** ![nsajko](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/nsajko/32/221187_2.png) [@nsajko](https://discourse.julialang.org/u/nsajko)\
**Post date:** [January 25, 2023, 12:53am UTC](https://discourse.julialang.org/t/about-pprof/93456/4 "2023-01-25T00:53:34Z")

</div>

Can’t you run the same thing locally? Otherwise you need a proper Web server setup, with support from the firewall, router, etc.

---

<div class="post-metadata">

**Author:** ![Kristin](https://avatars.discourse-cdn.com/v4/letter/k/2bfe46/32.png) [@Kristin](https://discourse.julialang.org/u/Kristin)\
**Post date:** [January 25, 2023, 1:26am UTC](https://discourse.julialang.org/t/about-pprof/93456/5 "2023-01-25T01:26:32Z")

</div>

I see, because the real code I want to check profile is quite computationaly expansive which I need run on a cluster, so I’m trying to get the profile feature work there.

But I just try to run the same thing locally, and got an error messgae:  
**zsh: no matches found: [main\_binary]**  
Does this mean I need install main\_binary? Thank you!

---

<div class="post-metadata">

**Author:** ![nsajko](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/nsajko/32/221187_2.png) [@nsajko](https://discourse.julialang.org/u/nsajko)\
**Post date:** [January 25, 2023, 2:28am UTC](https://discourse.julialang.org/t/about-pprof/93456/6 "2023-01-25T02:28:42Z")

</div>

Sorry, I don’t use the zsh shell, and I’ve no idea what `main_binary` is in your setup.

---

<div class="post-metadata">

**Author:** ![jameson](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jameson/32/23_2.png) [@jameson](https://discourse.julialang.org/u/jameson)\
**Post date:** [January 25, 2023, 4:22am UTC](https://discourse.julialang.org/t/about-pprof/93456/7 "2023-01-25T04:22:40Z")

</div>

If you have a remote shell, just set up a port redirect with ssh -L 62261:localhost:62261

---

<div class="post-metadata">

**Author:** ![stepanzh](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/stepanzh/32/34851_2.png) [@stepanzh](https://discourse.julialang.org/u/stepanzh)\
**Post date:** [January 25, 2023, 8:33am UTC](https://discourse.julialang.org/t/about-pprof/93456/8 "2023-01-25T08:33:35Z")

</div>

If you want to work locally, my suggestion is

1. Download profile file `alloc-profile.pb.gz` from the cluster
2. Install pprof locally (or see P.S.)
3. Run `pprof -http=localhost:57599 -relative_percentages profile.pb.gz`, you should see this

```plaintext
% pprof -http=localhost:57599 -relative_percentages profile.pb.gz
Main binary filename not available.
Serving web UI on http://localhost:57599

```

Notice that you need `-http` option, not `-web`. PProf.jl executes identical command itself ([see this](https://github.com/JuliaPerf/PProf.jl/blob/b2b0a25dbb43f145701585577c792580104ebf46/src/PProf.jl#L329)).

- After the command, the default browser should be opened at `localhost:57599`, if not, you may enter the address manually in the browser.
- Also, do not shut down your terminal.
- I don’t know what “Main binary” warning means, perhaps for Julia code it may be ignored.

If you want to work remotely, see @jameson’s answer. Also, I don’t know, if my suggestion is reproducible on Windows. In case of Windows, I would setup all remotely.

P.S. I’ve found that PProf.jl uses a wrapper around binary `pprof`, so it’s shipped with PProf.jl. For me, `pprof` was located in `.julia/artifacts/a-long-hash-code/bin/pprof`.

---

<div class="post-metadata">

**Author:** ![jmair](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jmair/32/35117_2.png) [@jmair](https://discourse.julialang.org/u/jmair)\
**Post date:** [January 25, 2023, 10:43am UTC](https://discourse.julialang.org/t/about-pprof/93456/9 "2023-01-25T10:43:29Z")

</div>

You need to port forward from your server, if you use VS code remote SSH to get in, you can open ports mid-session.

See docs - [Developing on Remote Machines using SSH and Visual Studio Code](https://code.visualstudio.com/docs/remote/ssh#_temporarily-forwarding-a-port)
