How To Install uftrace on Ubuntu 22.04
Introduction
In this tutorial we learn how to install uftrace
on Ubuntu 22.04.
What is uftrace
uftrace is:
The uftrace tool is intended for tracing and analyzing the execution of programs written in C or C++. It was heavily inspired by the ftrace framework of the Linux kernel (especially the function graph tracer) and supports userspace programs. It supports various kinds of commands and filters to help analysis of the program’s execution and performance.
It traces each function in the executable and shows time durations. It can also trace external library calls - but usually only entry and exit are supported. It is also possible to trace other (nested) external library calls and/or internal function calls in the library call.
It can show detailed execution flow at function level, and report which function has the highest overhead. It also shows various information related to the execution environment.
You can setup filters to exclude or include specific functions when tracing. In addition, function arguments and return values can be saved and shown later.
The uftrace tool supports multi-process and/or multi-threaded applications. It can also trace kernel functions as well, with root privileges and if the system enables the function graph tracer in the kernel (CONFIG_FUNCTION_GRAPH_TRACER=y).
There are three methods to install uftrace
on Ubuntu 22.04. We can use apt-get
, apt
and aptitude
. In the following sections we will describe each method. You can choose one of them.
Install uftrace Using apt-get
Update apt database with apt-get
using the following command.
sudo apt-get update
After updating apt database, We can install uftrace
using apt-get
by running the following command:
sudo apt-get -y install uftrace
Install uftrace Using apt
Update apt database with apt
using the following command.
sudo apt update
After updating apt database, We can install uftrace
using apt
by running the following command:
sudo apt -y install uftrace
Install uftrace Using aptitude
If you want to follow this method, you might need to install aptitude first since aptitude is usually not installed by default on Ubuntu. Update apt database with aptitude
using the following command.
sudo aptitude update
After updating apt database, We can install uftrace
using aptitude
by running the following command:
sudo aptitude -y install uftrace
How To Uninstall uftrace on Ubuntu 22.04
To uninstall only the uftrace
package we can use the following command:
sudo apt-get remove uftrace
Uninstall uftrace And Its Dependencies
To uninstall uftrace
and its dependencies that are no longer needed by Ubuntu 22.04, we can use the command below:
sudo apt-get -y autoremove uftrace
Remove uftrace Configurations and Data
To remove uftrace
configuration and data from Ubuntu 22.04 we can use the following command:
sudo apt-get -y purge uftrace
Remove uftrace configuration, data, and all of its dependencies
We can use the following command to remove uftrace
configurations, data and all of its dependencies, we can use the following command:
sudo apt-get -y autoremove --purge uftrace
References
Summary
In this tutorial we learn how to install uftrace
package on Ubuntu 22.04 using different package management tools: apt
, apt-get
and aptitude
.