A graphical Python profiler that provides a clear view of your application's execution while being both low-overhead and easy to use.
FunctionTrace can be called on existing Python applications with absolutely no modifications, and provides a complete and precise view of your application's entire execution. You'll see what functions your various Python processes and threads executed over time, when and what information was logged, where allocations occurred, and more.
FunctionTrace supports all of the useful profiling views you're familiar with, including Stack Charts, Flame Graphs, and Call Trees, thanks to its integration with the Firefox Profiler.
See precise profiling information throughout your entire application, rather than being limited to just one process or thread.
FunctionTrace can track allocations throughout function calls in your application, telling you where to focus your optimization efforts.
You'll never miss small but interesting function calls when looking at a FunctionTrace profile, as all information is recorded. You also don't need to pay for this - profiling overhead is <10%, even on complex applications.
When a developer encounters a bug or performance issue, they can easily send the recorded FunctionTrace profile to their team, allowing multiple people to investigate the issue without needing to reproduce it.
FunctionTrace comes in two necessary pieces: a server, and a language-specific client.
Note: It's currently necessary to have
cargo installed in order to install FunctionTrace, as
functiontrace-server is not yet packaged for the various supported operating systems. You can install cargo via rustup.
# Install the server $ cargo install functiontrace-server # Install the Python client $ pip install functiontrace
To trace a Python application Foo.py, load it via the
By default, FunctionTrace will emit a trace file (in the form of
$ python -m functiontrace Foo.py arguments_for_foo
functiontrace.time.json) to the current directory, though the location can be controlled via the
--output_dirswitch when running
To view a recorded trace file, go to the Firefox Profiler and choose Load a profile from file, then select the desired trace file. This step will perform some processing, but is entirely local - your trace file never leaves your own machine!
Note: If this is your first time using the Firefox Profiler, you may want to skim the UI guide for it.
You'll likely want to start with the Stack Chart view to get an overview of your application's execution, then use the Flame Graph view if you want to dive into optimization opportunities.
Traces can also be loaded directly from the internet, which can be particularly useful when examining services on remote servers or sharing traces with others. For an example, you can play with this Live Demo.