Canonical Introduces the etrace Utility, a Multipurpose Application Profiling Tool

Canonical

Canonical has introduced etrace, a utility designed to track activity during application execution. The program resembles the strace and ltrace utilities and also uses ptrace at runtime.

The goal etrace principal is debugging and analyzing started applications from snap The utility allows you to quickly evaluate which programs and files are used when running a snap package.

Two commands are provided, "exec" and "file", for information on how to access files and run other processes. In the first case, the work of file-related system calls is monitored, and in the second, the executive system call family is intercepted.

Etrace is a generic tracking application, useful for three broad measurement and debugging purposes:

  • How long it takes an application to display a window (graphical / UI) on a screen.
  • The sequence of tasks created and executed by the main program during its execution time. The list of files that are accessed during the execution of a program.

These metrics can be used to debug potential problems in snaps and understand what a package is trying to snap or find performance bottlenecks in an instant.

Of course, also works with native linux packages or any executable program, albeit with slightly reduced out-of-the-box functionality (it doesn't reinstall the native package, for example), but you can still crawl the app and measure how long it takes to display a window.

The utility can also be used to identify bottlenecks performance in X11-based graphics applications and shows how long it takes for the application to initialize before starting to render the window.

In addition, the specific snap options "–reinstall-snap" and "–clean-snap-user-data" are available, allowing you to reinstall the snap package to perform a cache-free measurement or remove user data associated with the package before running it.

Basic use

Etrace is available as a snap package, so we have to install it first. Because etrace is used to run arbitrary programs, including other snap packages and even traditional linux packages, it requires system-wide permissions through classic lockdown, which can be accepted by using the –classic flag when executing the following command.

To install etrace:

snap install etrace --candidate --classic

The first etrace use case is to measure how long it takes a graphics application to display a window on a screen.

Let's start with a simple plugin, gnome-calculator, and cycle it 10 times to see how long this execution takes. Note that you need to have gnome-calculator installed - install gnome-calculator. Here we use the –no-trace option because we don't want the full trace stack, we just want etrace to measure how long it takes to start up; we'll get into full tracking capabilities later.

etrace --repeat = 10 exec --use-snap-run --no-trace gnome-calculator --cmd-stderr = /dev/null
Total startup time: 1.531152957s
Total startup time: 513.948576ms
Total startup time: 512.980061ms
Total startup time: 515.576753ms
Total startup time: 508.354472ms
Total startup time: 515.734329ms
Total startup time: 508.414271ms
Total startup time: 514.258788ms
Total startup time: 508.407346ms
Total startup time: 511.950964ms

In addition, Canonical announced the implementation of snap support for the compression algorithm LZO. The LZO algorithm focuses on achieving maximum decompression speed, at the cost of increasing the size of the resulting file. When testing a package with Chromium, using LZO instead of the default XZ algorithm allows you to speed up the release of the snap package 2-3 times by reducing the time required to decompress the SquashFS image.

In particular, the first Chromium launch installed from a normal deb package takes about 1,7 seconds.

The first release from snap when using XZ takes 8.1 seconds and when using LZO - 3.1 seconds. On reboot, with the data cached, the startup times are 0,6, 0,7, and 0,6 seconds. respectively.

The size of the snap package has increased from 150MB to 250MB with LZO.


Leave a Comment

Your email address will not be published. Required fields are marked with *

*

*

  1. Responsible for the data: Miguel Ángel Gatón
  2. Purpose of the data: Control SPAM, comment management.
  3. Legitimation: Your consent
  4. Communication of the data: The data will not be communicated to third parties except by legal obligation.
  5. Data storage: Database hosted by Occentus Networks (EU)
  6. Rights: At any time you can limit, recover and delete your information.