JuliaPerf / PProf.jl

Export Julia profiles to the pprof format
MIT License
155 stars 18 forks source link

Embed a precompiled `pprof` binary and launch it in `pprof()`! #7

Closed NHDaly closed 5 years ago

NHDaly commented 5 years ago

Download the cross-compiled pprof binaries, and launch pprof in web-mode when user calls pprof()! :)

NHDaly commented 5 years ago

For the record, here is the build-script I used to produce the cross-compiled go pprof binaries:

cwd = pwd()
GOPATH = ENV["GOPATH"]

# Install pprof
run(`go get -u github.com/google/pprof`)

# Cross compile it
run(`go get -u github.com/mitchellh/gox`)
cd("$GOPATH/src/github.com/google/pprof")
try  # It's okay if this fails for some of the arch × os pairs
    run(`$GOPATH/bin/gox -os="linux freebsd darwin windows" -arch="ppc64 arm arm64 386 amd64" -output="$GOPATH/dist/pprof/pprof_{{.OS}}_{{.Arch}}/pprof"`)
catch end

cd("$GOPATH/dist/pprof")
mkpath("release")
for f in readdir()
    run(`tar -czvf release/$f.tar.gz $f`)
end

println(joinpath(pwd(), "release"))

cd(cwd)
NHDaly commented 5 years ago

Bummer, it looks like the tests fail, complaining:

Failed to execute dot. Is Graphviz installed?
exec: "dot": executable file not found in $PATH

~So we may need to install more stuff than just pprof... it might automatically install other deps?~

EDIT: Ah, it's listed as a required dependency: https://github.com/google/pprof#building-pprof

I guess we could try to package that up as well? :/

vchuravy commented 5 years ago

:)

NHDaly commented 5 years ago

K well, i've added a sentence to the README that if you want to use the web view, you need graphviz. It seems to me that almost everyone has it, so this shouldn't be a big deal! :)

Merging this now!