Skip to content

Commit

Permalink
uftrace: Release v0.14
Browse files Browse the repository at this point in the history
This is a new release with some interesting changes!

The first thing is Python language support.  Now uftrace can trace python
functions and methods like C/C++ functions.  Internally, it uses python's
sys.setprofile() and pass the entry/exit info to the libmcount.

For example, it can trace the following python script (it needs to be a
standalone executable - it should have #! line and executable permission).

    $ cat abc.py
    #! /usr/bin/python3
    def a(): b()
    def b(): c()
    def c(): print("Hello")
    if __name__ == '__main__':
        a()

    $ chmod +x abc.py

Then uftrace can trace the functions like below:

    $ uftrace abc.py
    Hello
    # DURATION     TID     FUNCTION
                [235209] | __main__.<module>() {
                [235209] |   a() {
                [235209] |     b() {
                [235209] |       c() {
      10.810 us [235209] |         builtins.print();
      14.926 us [235209] |       } /* c */
      16.628 us [235209] |     } /* b */
      18.867 us [235209] |   } /* a */
      22.000 us [235209] | } /* __main__.<module> */

Not all features work well with python scripts, but filters by name (-F
and -N), depth (-D), time (-t), location (-L) would work.  However you
can use full features for analysis after recording the data.

The next is the improved agent control.  The agent listens to a client
connection in background when started with -g option.  Then users can
connect to it with uftrace live using -p <PID> option.  The <PID> should
be a process ID of the target, not the uftrace itself.

Say we want to trace my program with a filter at first.  Please don't
forget to start an agent.

    $ uftrace record -g -F ^mycode -- myprog

Later we don't want to use the function filter anymore, and decided to use
a time filter instead.  Let's change the option for the uftrace record
like below:

    $ uftrace -p $(pidof myprog) -F ^mycode@clear -t 100us

Note that the above command would not produce any data and just pass the
new options to the existing uftrace record session (for myprog).

One more big thing is Android build support.  While it's not officially
supported, you can build uftrace as an external tool.  This needed various
improvements in terms of portability like abstracting shmem access and
better handling of the tmp directory and dynamic linker behaviors.

It has been tested with Android 9+ on AArch64 and x86_64.  You probably
want to use dynamic tracing due to issues with the Android runtime.
Please see INSTALL.md for the details.

The size filter at replay now works as same as record, since the symbol
file format was changed to save the symbol size as well.

Symbol demangling on Rust programs was improved to handle trait names in a
more compact way.  The new demangling scheme (v0) is not supported yet.

There are also more fixes and improvements.  Thank you contributors!

Signed-off-by: Namhyung Kim <[email protected]>
  • Loading branch information
namhyung committed Jun 20, 2023
1 parent 64ac6a5 commit 04d73dc
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 1 deletion.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
VERSION := 0.13
VERSION := 0.14

# Makefiles suck: This macro sets a default value of $(2) for the
# variable named by $(1), unless the variable has been set by
Expand Down
26 changes: 26 additions & 0 deletions NEWS
Original file line number Diff line number Diff line change
@@ -1,3 +1,29 @@
uftrace v0.14
=============
* new options
--trigger option is restored
--trace=(on|off) option to deprecate --disable
filters and triggers can be deleted with @clear action (with agent)

* new features
python tracing (#436, #1640, #1641, #1676)
change options at runtime with agent (#1665, #1678, #1643, #1644, #1645, #1646)

* bug fixes
Lots of fixes for the test infra (#1628)

* other changes
Android build support (#1605)
Update symbol file format to add symbol size (#1616)
Improve Rust symbol demangling (#1625)
Change default library install path (#1618)
Use C11 + GNU extensions for compilation (#1642)

And many other fixes and improvements. Thanks all contributors:
Bernhard Kaindl, ChoKyuWon, Clément Guidi, Honggyu Kim, Kang Minchul,
Khem Raj, Michelle Jin, Namhyung Kim, Sangwon Hong, Yi Hong, Yuri Gribov


uftrace v0.13
=============
* new options
Expand Down

0 comments on commit 04d73dc

Please sign in to comment.