New package: ProfilePerfetto.jl
I made a new package! With @perfetto, you can profile a piece of code, and view the profile using the Perfetto browser-based trace viewer.
Example
using ProfilePerfetto
@perfetto_open my_function()
This will profile your code, and open the Perfetto web UI with your trace loaded. You can then use the Perfetto interface to navigate (WASD keys) and inspect:
Statistics, flame chart
Perfetto has many useful features, which we now get for free! This includes statistics for a given selection:
A flame chart viewer with multiple display options:
And more features can be discovered in the Perfetto documentation ![]()
Bonus feature 1: Automatic sampling rate
To make profiling more accessible, ProfilePerfetto will automatically find a good sampling rate for you. It does this by running your code multiple times, and gradually increasing the sampling rate.
julia> @perfetto_open do_some_work(600, 400, 500)
[ Info: 🔬 @perfetto: calibrating — 172.1 ms at Δ=10.0 ms (1.0×), sharpening to Δ=1.25 ms
[ Info: 🔬 @perfetto: calibrating — 97.7 ms at Δ=1.25 ms (1.0×), sharpening to Δ=156.2 μs
[ Info: 🔬 @perfetto: calibrating — 129.6 ms at Δ=156.2 μs (1.3×), sharpening to Δ=42.7 μs
[ Info: 🔬 @perfetto: calibrating — 186.2 ms at Δ=42.7 μs (1.9×), sharpening to Δ=22.5 μs
[ Info: 🔬 @perfetto: calibrating — 232.0 ms at Δ=22.5 μs (2.4×), sharpening to Δ=14.5 μs
[ Info: 🎯 @perfetto: 420.9 ms at Δ=14.5 μs (2% buffer, 4.3× baseline, round 6)
"/var/folders/v_/fhpj9jn151d4p9c2fdw2gv780000gn/T/jl_0HA38BsxYv.html"
Bonus feature 2: Isolated function call
When profiling with other tools, you might have noticed lots of ‘noise’ from the REPL, the profiler, etc, showing up in your profile. ProfilePerfetto uses a clever trick to only show the profile of the code that you wrote.
No bonus features?
If you don’t want these extra features, then you can use just the viewing functionality of ProfilePerfetto together with manual profiling:
using Profile, ProfilePerfetto
Profile.clear()
Profile.@profile my_workload()
perfetto_open() # or perfetto_view() in VS Code
Inside VS Code, Pluto, Jupyter, etc
From the REPL, you can use @perfetto_open to open the perfetto viewer in your default browser.
But in Pluto, VS Code, Jupyter, or other interactive coding environments, you can use @perfetto instead. The profile viewer will then display inline, like a plot. Here is an example in Pluto:
Use of AI
I used vibe coding to write large parts of this package. I reviewed all code, but I tried to let the AI ‘do its thing’ instead of managing too much. It works really well! I wrote this post by hand.
Why this package?
I think Julia needs better developer tooling, and I am especially interested in easy to use and reliable tooling. I hope this package will make it easier for users to profile their code.
Still, there is a lot more that can be done! The information gathered and displayed by ProfilePerfetto is still very minimal, and the automatic rate detection can be improved. Feel free to contribute to the package!
What do you think?
Try it out and let me know what you think!


