JuliaPerf / JuliaPerf/PProf.jl
PProf fails to build `dot` graph if name contains `"`
- Dominant language
- Julia
- Stars
- 173
- Forks
- 20
- PR merge metrics
- No merged PRs in 30d
Description
For example:
```julia
julia> function var"#fo\"o#"()
peakflops()
end
#fo"o# (generic function with 1 method)
julia> var"#fo\"o#"()
1.8314014985396976e11
julia> Profile.clear()
julia> @profile var"#fo\"o#"()
1.7486120937946786e11
julia> pprof(out="var", webport=2232)
[ Info: Writing output to var.pb.gz
"var.pb.gz"
julia> Main binary filename not available.
Serving web UI on http://localhost:2232
Error: : syntax error in line 39 near 'N37'
Failed to execute dot. Is Graphviz installed?
exit status 1
Error: : syntax error in line 39 near 'N37'
Failed to execute dot. Is Graphviz installed?
exit status 1
```
By dumping the `dot` file, you can see the mistake: `pprof` itself is not escaping the name correctly:
```julia
julia> PProf.pprof_jll.pprof() do _
io = IOBuffer()
run(pipeline(`pprof -dot var.pb.gz`, stdout=io))
write("profile.dot", String(take!(io)))
end
```
```dot
N35 [label="LinearAlgebra\npeakflops##kw\n0 of 47 (47.00%)" id="node35" fontsize=8 shape=box tooltip="LinearAlgebra.peakflops##kw (47)" color="#b22400" fillcolor="#eddad5"]
N36 [label="Main\n#fo"o#\n0 of 47 (47.00%)" id="node36" fontsize=8 shape=box tooltip="Main.#fo"o# (47)" color="#b22400" fillcolor="#eddad5"]
N37 [label="REPL\n#run_repl#41\n0 of 47 (47.00%)" id="node37" fontsize=8 shape=box tooltip="REPL.#run_repl#41 (47)" color="#b22400" fillcolor="#eddad5"]
```
-------
I'm going to open a PR against `pprof` to fix this. But if it stalls, we may want to escape the names we provide to the proto, but it's annoying because then they print ugly (and incorrectly) in the flamegraph
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.