Git Product home page Git Product logo

austin's Introduction

Austin

A Frame Stack Sampler for CPython

         

GitHub Action Status: Tests GitHub Action Status: Checks Code coverage latest release LICENSE
PyPI version Chocolatey Version Conda Version homebrew austin Snap Store Build Status

Get it from the Snap Store

Synopsis • Installation • Usage • Cheat sheet • Compatibility • Why Austin • Examples • Contribute

Buy Me A Coffee


This is the nicest profiler I’ve found for Python. It’s cross-platform, doesn’t need me to change the code that’s being profiled, and its output can be piped directly into flamegraph.pl. I just used it to pinpoint a gross misuse of SQLAlchemy at work that’s run in some code at the end of each day, and now I can go home earlier.

-- gthm on lobste.rs

If people are looking for a profiler, Austin looks pretty cool. Check it out!

-- Michael Kennedy on Python Bytes 180

Follow on Twitter


Synopsis

Austin is a Python frame stack sampler for CPython written in pure C. Samples are collected by reading the CPython interpreter virtual memory space to retrieve information about the currently running threads along with the stack of the frames that are being executed. Hence, one can use Austin to easily make powerful statistical profilers that have minimal impact on the target application and that don't require any instrumentation.

The key features of Austin are:

  • Zero instrumentation;
  • Minimal impact;
  • Fast and lightweight;
  • Time and memory profiling;
  • Built-in support for multi-process applications (e.g. mod_wsgi).

The simplest way to turn Austin into a full-fledged profiler is to use together with the VS Code extension or combine it with FlameGraph or Speedscope. However, Austin's simple output format can be piped into any other external or custom tool for further processing. Look, for instance, at the following Python TUI

Check out A Survey of Open-Source Python Profilers by Peter Norton for a general overview of Austin.

Keep reading for more tool ideas and examples!


💜
Austin is a free and open-source project. A lot of effort goes into its development to ensure the best performance and that it stays up-to-date with the latest Python releases. If you find it useful, consider sponsoring this project.
🙏


Installation

Austin is available to install from PyPI and from the major software repositories of the most popular platforms. Check out the latest release page for pre-compiled binaries and installation packages.

On all supported platforms and architectures, Austin can be installed from PyPI with pip or pipx via the commands

pip install austin-dist

or

pipx install austin-dist

On Linux, it can be installed using autotools or as a snap from the Snap Store. The latter will automatically perform the steps of the autotools method with a single command. On distributions derived from Debian, Austin can be installed from the official repositories with Aptitude. Anaconda users can install Austin from Conda Forge.

On Windows, Austin can be easily installed from the command line using either Chocolatey or Scoop. Alternatively, you can download the installer from the latest release page.

On macOS, Austin can be easily installed from the command line using Homebrew. Anaconda users can install Austin from Conda Forge.

For any other platforms, compiling Austin from sources is as easy as cloning the repository and running the C compiler. The Releases page has many pre-compiled binaries that are ready to be uncompressed and used.

With autotools

Installing Austin using autotools amounts to the usual ./configure, make and make install finger gymnastic. The only dependency is the standard C library. Before proceeding with the steps below, make sure that the autotools are installed on your system. Refer to your distro's documentation for details on how to do so.

git clone --depth=1 https://github.com/P403n1x87/austin.git && cd austin
autoreconf --install
./configure
make
make install

NOTE Some Linux distributions, like Manjaro, might require the execution of automake --add-missing before ./configure.

Alternatively, sources can be compiled with just a C compiler (see below).

From the Snap Store

Austin can be installed on many major Linux distributions from the Snap Store with the following command

sudo snap install austin --classic

On Debian and Derivatives

On March 30 2019 Austin was accepted into the official Debian repositories and can therefore be installed with the apt utility.

sudo apt-get update -y && sudo apt-get install austin -y

On macOS

Austin can be installed on macOS using Homebrew:

brew install austin

From Chocolatey

To install Austin from Chocolatey, run the following command from the command line or from PowerShell

choco install austin

To upgrade run the following command from the command line or from PowerShell:

choco upgrade austin

From Scoop

To install Austin using Scoop, run the following command from the command line or PowerShell

scoop install austin

To upgrade run the following command from the command line or PowerShell:

scoop update

From Conda Forge

Anaconda users on Linux and macOS can install Austin from Conda Forge with the command

conda install -c conda-forge austin

From Sources without autotools

To install Austin from sources using the GNU C compiler, without autotools, clone the repository with

git clone --depth=1 https://github.com/P403n1x87/austin.git

On Linux, one can then use the command

gcc -O3 -Os -Wall -pthread src/*.c -o src/austin

whereas on macOS it is enough to run

gcc -O3 -Os -Wall src/*.c -o src/austin

On Windows, the -lpsapi -lntdll switches are needed

gcc -O3 -Os -Wall -lpsapi -lntdll src/*.c -o src/austin

Add -DDEBUG if you need a more verbose log. This is useful if you encounter a bug with Austin and you want to report it here.

Usage

Usage: austin [OPTION...] command [ARG...]
Austin is a frame stack sampler for CPython that is used to extract profiling
data out of a running Python process (and all its children, if required) that
requires no instrumentation and has practically no impact on the tracee.

  -b, --binary               Emit data in the MOJO binary format. See
                             https://github.com/P403n1x87/austin/wiki/The-MOJO-file-format
                             for more details.
  -C, --children             Attach to child processes.
  -e, --exclude-empty        Do not output samples of threads with no frame
                             stacks.
  -f, --full                 Produce the full set of metrics (time +mem -mem).
  -g, --gc                   Sample the garbage collector state.
  -h, --heap=n_mb            Maximum heap size to allocate to increase sampling
                             accuracy, in MB (default is 0).
  -i, --interval=n_us        Sampling interval in microseconds (default is
                             100). Accepted units: s, ms, us.
  -m, --memory               Profile memory usage.
  -o, --output=FILE          Specify an output file for the collected samples.
  -p, --pid=PID              Attach to the process with the given PID.
  -P, --pipe                 Pipe mode. Use when piping Austin output.
  -s, --sleepless            Suppress idle samples to estimate CPU time.
  -t, --timeout=n_ms         Start up wait time in milliseconds (default is
                             100). Accepted units: s, ms.
  -w, --where=PID            Dump the stacks of all the threads within the
                             process with the given PID.
  -x, --exposure=n_sec       Sample for n_sec seconds only.
  -?, --help                 Give this help list
      --usage                Give a short usage message
  -V, --version              Print program version

Mandatory or optional arguments to long options are also mandatory or optional
for any corresponding short options.

Report bugs to <https://github.com/P403n1x87/austin/issues>.

The output is a sequence of frame stack samples, one on each line. The format is the collapsed one that is recognised by FlameGraph so that it can be piped straight to flamegraph.pl for a quick visualisation, or redirected to a file for some further processing.

By default, each line has the following structure:

P<pid>;T<iid>:<tid>[;[frame]]* [metric]*

where the structure of [frame] and the number and type of metrics on each line depend on the mode. The <pid>, <iid> and <tid> component represent the process ID, the sub-interpreter ID, and the thread ID respectively.

Environment variables

Some behaviour of Austin can be configured via environment variables.

Variable Effect
AUSTIN_NO_LOGGING Disables all log messages (since Austin 3.4.0).

Normal Mode

In normal mode, the [frame] part of each emitted sample has the structure

[frame] := <module>:<function>:<line number>

Each line then ends with a single [metric], i.e. the sampling time measured in microseconds.

NOTE This was changed in Austin 3. In previous version, the alternative format used to be the default one.

Binary Mode

The output generated by Austin by default can be quickly visualised by some existing tools without further processing. However, this comes at the cost of potentially big raw output files. The binary mode can be used to produce a more compact binary representation of the collected data, and more efficiently, by exploiting the performance enhancement of internal caching of frame data.

The mojo2austin CLI tool that comes with the austin-python Python package can be used to convert a MOJO file back to the standard Austin output. Be aware that the resulting file might be quite large, well over 4 times the size of the MOJO file itself.

More details about the MOJO binary format can be found in the Wiki.

Since Austin 3.4.0.

Column-level Location Information

Since Python 3.11, code objects carry finer-grained location information at the column level. When using the binary MOJO format, Austin can extract this extra location information when profiling code running with versions of the interpreter that expose this data.

Since Austin 3.5.0.

Memory and Full Metrics

When profiling in memory mode with the -m or --memory switch, the metric value at the end of each line is the memory delta between samples, measured in bytes. In full mode (-f or --full switches), each sample ends with a comma-separated list of three values: the time delta, the idle state (1 for idle, 0 otherwise) and the RSS memory delta (positive for memory allocations, negative for deallocations). This way it is possible to estimate wall-clock time, CPU time and memory pressure, all from a single run.

NOTE The reported memory allocations and deallocations are obtained by computing resident memory deltas between samples. Hence these values give an idea of how much physical memory is being requested/released.

Multi-process Applications

Austin can be told to profile multi-process applications with the -C or --children switch. This way Austin will look for new children of the parent process.

Sub-interpreters

Austin has support for Python applications that make use of sub-interpreters. This means that Austin will sample all the sub-interpreters that are running within each process making up the Python application.

Since Austin 3.6.0.

Garbage Collector Sampling

Austin can sample the Python garbage collector state for applications running with Python 3.7 and later versions. If the -g/--gc option is passed, Austin will append :GC: at the end of each collected frame stack whenever the garbage collector is collecting. This gives you a measure of how busy the Python GC is during a run.

Since Austin 3.1.0.

Where?

If you are only interested in what is currently happening inside a Python process, you can have a quick overview printed on the terminal with the -w/--where option. This takes the PID of the process whose threads you want to inspect, e.g.

sudo austin -w `pgrep -f my-running-python-app`

Below is an example of what the output looks like

Austin where mode example

This works with the -C/--children option too. The emojis to the left indicate whether the thread is active or sleeping and whether the process is a child or not.

Since Austin 3.3.0.

Sampling Accuracy

Austin tries to keep perturbations to the tracee at a minimum. To do so, the tracee is never halted. To improve sampling accuracy, Austin can allocate a heap that is used to get large snapshots of the private VM of the tracee that is likely to contain frame information in a single attempt. The larger the heap is allowed the grow, the more accurate the results. The maximum size of the heap that Austin is allowed to allocate can be controlled with the -h/--heap option, followed by the maximum size in bytes. By default, Austin does not allocate a heap, which is ideal for systems with limited resources. If you think your results are not accurate, try setting this parameter.

Since Austin 3.2.0.

Changed in Austin 3.3.0: the default heap size is 0.

Native Frame Stack

If you want observability into the native frame stacks, you can use the austinp variant of austin which can be obtained by compiling the source with -DAUSTINP on Linux, or from the released binaries.

austinp makes use of ptrace to halt the application and grab a snapshot of the call stack with libunwind. If you are compiling austinp from sources make sure that you have the development version of the libunwind library available on your system, for example on Ubuntu,

sudo apt install libunwind-dev binutils-dev

and compile with

gcc -O3 -Os -Wall -pthread src/*.c -DAUSTINP -lunwind-ptrace -lunwind-generic -lbfd -o src/austinp

then use as per normal. The extra -k/--kernel option is available with austinp which allows sampling kernel call stacks as well.

WARNING Since austinp uses ptrace, the impact on the tracee is no longer minimal and it becomes higher at smaller sampling intervals. Therefore the use of austinp is not recommended in production environments. For this reason, the default sampling interval for austinp is 10 milliseconds.

The austinp-resolve tool from the austin-python Python package can be used to resolve the VM addresses to source and line numbers, provided that the referenced binaries have DWARF debug symbols. Internally, the tool uses addr2line(1) to determine the source name and line number given an address, when possible.

Whilst austinp comes with a stripped-down implementation of addr2line, it is only used for the "where" option, as resolving symbols at runtime is expensive. This is to minimise the impact of austinp on the tracee, increase accuracy and maximise the sampling rate.

The where option is also available for the austinp variant and will show both native and Python frames. Highlighting helps tell frames apart. The -k option outputs Linux kernel frames too, as shown in this example

Austin where mode example

NOTE If you have installed Austin from the Snap Store, the austinp executable will be available as austin.p from the command line.

Logging

Austin uses syslog on Linux and macOS, and %TEMP%\austin.log on Windows for log messages, so make sure to watch these to get execution details and statistics. Bad frames are output together with the other frames. In general, entries for bad frames will not be visible in a flame graph as all tests show error rates below 1% on average.

Logging can be disabled using environment variables.

Cheat sheet

All the above Austin options and arguments are summarised in a cheat sheet that you can find in the doc folder in either the SVG, PDF or PNG format

Compatibility

Austin supports Python 3.8 through 3.12, and has been tested on the following platforms and architectures

x86_64
i686
armv7
arm64
ppc64le

NOTE Austin might work with other versions of Python on all the platforms and architectures above. So it is worth giving it a try even if your system is not listed below. If you are looking for support for Python < 3.8, you can use Austin 3.5.

Because of platform-specific details, Austin usage may vary slightly. Below are further compatibility details to be aware of.

On Linux

Austin requires the CAP_SYS_PTRACE capability to attach to an external process. This means that you will have to either use sudo when attaching to a running Python process or grant the CAP_SYS_PTRACE capability to the Austin binary with, e.g.

sudo setcap cap_sys_ptrace+ep `which austin`

To use Austin with Docker, the --cap-add SYS_PTRACE option needs to be passed when starting a container.

On MacOS

Due to the System Integrity Protection, introduced in MacOS with El Capitan, and the Hardened Runtime, introduced in Mojave, Austin cannot profile Python processes that use an executable located in the /bin folder, or code-signed, even with sudo. This is the case for the system-provided version of Python, and the one installed with the official installers from python.org. Other installation methods, like pyenv or Anaconda or Homebrew are known to work with Austin, out of the box.

To use Austin with Python from the official installer, you could remove the signature from the binaries with

codesign --remove-signature /Library/Frameworks/Python.framework/Versions/<M.m>/bin/python3
codesign --remove-signature /Library/Frameworks/Python.framework/Versions/<M.m>/Resources/Python.app/Contents/MacOS/Python

Alternatively, you could self-sign the Austin binary with the Debugging Tool Entitlement, as done for debugging tools like GDB. However, this method has not been tested.

Austin requires the use of sudo to work on MacOS. To avoid having to type the password every time you use Austin, consider adding a rule to the sudoers file, e.g.

yourusername  ALL = (root) NOPASSWD: /usr/local/bin/austin

Why Austin

When there already are similar tools out there, it's normal to wonder why one should be interested in yet another one. So here is a list of features that currently distinguish Austin.

  • Written in pure C Austin is written in pure C code. There are no dependencies on third-party libraries except for the standard C library and the API provided by the Operating System.

  • Just a sampler Austin is just a frame stack sampler. It looks into a running Python application at regular intervals of time and dumps whatever frame stack it finds. The samples can then be analysed at a later time so that Austin can sample at rates higher than other non-C alternatives that perform some aggregations at run-time.

  • Simple output, powerful tools Austin uses the collapsed stack format of FlameGraph that is easy to parse. You can then go and build your own tool to analyse Austin's output. You could even make a player that replays the application execution in slow motion, so that you can see what has happened in temporal order.

  • Small size Austin compiles to a single binary executable of just a bunch of KB.

  • Easy to maintain Occasionally, the Python C API changes and Austin will need to be adjusted to new releases. However, given that Austin, like CPython, is written in C, implementing the new changes is rather straight-forward.

Examples

The following flame graph has been obtained with the command

austin -i 1ms ./test.py | sed '/^#/d' | ./flamegraph.pl --countname=μs > test.svg

where the sample test.py script has the execute permission and the following content

#!/usr/bin/env python3

import dis

for i in range(1000):
    dis.dis(dis.dis)

To profile Apache2 WSGI application, one can attach Austin to the web server with

austin -Cp `pgrep apache2 | head -n 1`

Any child processes will be automatically detected as they are created and Austin will sample them too.

IDE Extensions

It is easy to write your own extension for your favourite text editor. This, for example, is a demo of a Visual Studio Code extension that highlights the most hit lines of code straight into the editor

Austin TUI

The Austin TUI is a text-based user interface for Austin that gives you a top-like view of what is currently running inside a Python application. It is most useful for scripts that have long-running procedures as you can see where execution is at without tracing instructions in your code. You can also save the collected data from within the TUI and feed it to Flame Graph for visualisation, or convert it to the pprof format.

If you want to give it a go you can install it using pip with

pip install austin-tui --upgrade

and run it with

austin-tui [OPTION...] command [ARG...]

with the same command line as Austin. Please note that the austin binary should be available from within the PATH environment variable in order for the TUI to work.

The TUI is based on python-curses. The version included with the standard Windows installations of Python is broken so it won't work out of the box. A solution is to install the wheel of the port to Windows from this page. Wheel files can be installed directly with pip, as described in the linked page.

Austin Web

Austin Web is a web application that wraps around Austin. At its core, Austin Web is based on d3-flame-graph to display a live flame graph in the browser, that refreshes every 3 seconds with newly collected samples. Austin Web can also be used for remote profiling by setting the --host and --port options.

If you want to give it a go you can install it using pip with

pip install austin-web --upgrade

and run it with

austin-web [OPTION...] command [ARG...]

with the same command line as Austin. This starts a simple HTTP server that serves on localhost by default. When no explicit port is given, Austin Web will use an ephemeral one.

Please note that the austin binary should be available from within the PATH environment variable in order for Austin Web to work.

Speedscope

Austin output is now supported by Speedscope. However, the austin-python library comes with format conversion tools that allow converting the output from Austin to the Speedscope JSON format.

If you want to give it a go you can install it using pip with

pip install austin-python --upgrade

and run it with

austin2speedscope [-h] [--indent INDENT] [-V] input output

where input is a file containing the output from Austin and output is the name of the JSON file to use to save the result of the conversion, ready to be used on Speedscope.

Google pprof

Austin's format can also be converted to the Google pprof format using the austin2pprof utility that comes with austin-python. If you want to give it a go you can install it using pip with

pip install austin-python --upgrade

and run it with

austin2pprof [-h] [-V] input output

where input is a file containing the output from Austin and output is the name of the protobuf file to use to save the result of the conversion, ready to be used with Google's pprof tools.

Contribute

If you like Austin and you find it useful, there are ways for you to contribute.

If you want to help with the development, then have a look at the open issues and have a look at the contributing guidelines before you open a pull request.

You can also contribute to the development of the Austin by becoming a sponsor and/or by buying me a coffee on BMC or by chipping in a few pennies on PayPal.Me.

Buy Me A Coffee


Follow on Twitter

austin's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

austin's Issues

austin 3.5.0 regression test failure

Description

Trying to upgrade austin to the latest release, 3.7.0, but ran into some testing failure as below:

==> /opt/homebrew/Cellar/austin/3.5.0/bin/austin python3.11 -c "from time import sleep; sleep(1)"
              _   _
 __ _ _  _ __| |_(_)_ _
/ _` | || (_-<  _| | ' \
\__,_|\_,_/__/\__|_|_||_| 3.5.0 [GCC 4.2.1]

👾 It looks like you are trying to profile a process that is not a Python
process. Make sure that you are targeting the right application. If the Python
process is actually a child of the target process then use the -C option to
discover it automatically.
Error: austin: failed
An exception occurred within a child process:
  Minitest::Assertion: Expected: 37
  Actual: 32

Steps to Reproduce

  1. wget https://raw.githubusercontent.com/Homebrew/homebrew-core/9416b600dc4af5fe452259d62c58508e633f9180/Formula/austin.rb
  2. HOMEBREW_NO_INSTALL_CLEANUP=1 brew install -s austin.rb

This should be the same as default installation steps in the README.

Expected behavior: [What you expect to happen]

test pass.

Actual behavior: [What actually happens]

as above.

Reproduces how often: [What percentage of the time does it reproduce?]

consistently reproducible, on linux, it actually works fine.

==> Testing austin                                                                                                                                                         │···················
/home/linuxbrew/.linuxbrew/Homebrew/Library/Homebrew/test.rb (Formulary::FromPathLoader): loading /home/linuxbrew/.linuxbrew/Homebrew/Library/Taps/homebrew/homebrew-core/F│···················
ormula/austin.rb                                                                                                                                                           │···················
/usr/bin/env /home/linuxbrew/.linuxbrew/Homebrew/Library/Homebrew/shims/shared/git --version                                                                               │···················
/home/linuxbrew/.linuxbrew/Homebrew/Library/Homebrew/test.rb (Formulary::FormulaLoader): loading /home/linuxbrew/.linuxbrew/Homebrew/Library/Taps/homebrew/homebrew-core/Fo│···················
rmula/[email protected]                                                                                                                                                            │···················
==> /home/linuxbrew/.linuxbrew/Cellar/austin/3.5.0/bin/austin python3.11 -c "from time import sleep; sleep(1)"                                                             │···················
              _   _                                                                                                                                                        │···················
 __ _ _  _ __| |_(_)_ _                                                                                                                                                    │···················
/ _` | || (_-<  _| | ' \                                                                                                                                                   │···················
\__,_|\_,_/__/\__|_|_||_| 3.5.0 [GCC 11.3.0]                                                                                                                               │···················
                                                                                                                                                                           │···················
🐍 Python version: 3.11.2                                                                                                                                                  │···················
                                                                                                                                                                           │···················
Statistics                                                                                                                                                                 │···················
⌛ Sampling duration : 1.02 s                                                                                                                                              │···················
⏱️  Frame sampling (min/avg/max) : 5/8/729 μs                                                                                                                               │···················
🐢 Long sampling rate : 12/6213 (0.19 %) samples took longer than the sampling interval to collect                                                                         │···················
💀 Error rate : 4/6213 (0.06 %) invalid samples

Versions

austin 3.7.0

You can get this information from copy and pasting the output of austin --version from the command line. Also, please include the OS and what version
of the OS you're running.

Additional Information

relates to Homebrew/homebrew-core#123851

Any additional information, configuration or data that might be necessary to
reproduce the issue.

Cannot launch the given command

Description

When I try to run the documented example: austin -i 1ms ./test.py on

import psutil

for i in range(1000):
    list(psutil.process_iter())

I get the error

❌ Cannot launch the given command. Either it is not valid or the process
terminated too quickly.

Steps to Reproduce

Given in description

Expected behavior:
I expect the command to run.

Actual behavior:
The above error message

Reproduces how often:
100% of the time

Versions

3.1.0 on Manjaro 21.1.5

Running austin fails with "no such process"

Description

Running austin on any file fails with the output "no such process".

Steps to Reproduce

  1. Installed Austin first with autotools then with snap on xubuntu 18.04
  2. ran Austin on test script as described in readme file: "austin -i 50 ./test.py"

Expected behavior: [What you expect to happen]
Program ran

Actual behavior: [What actually happens]
"no such process" given as output

Reproduces how often: [What percentage of the time does it reproduce?]
100 %

Versions

1.0.1

Additional Information

I tried to run tests to see if that could help identify the problem, but I didn't figure out how to actually run the tests.

Building Austin on Manjaro

Description

As initially cloned, I was unable to build Austin on my Manjaro system.

Steps to Reproduce

  1. Clone Austin
  2. Execute ./configure
  3. See errors

Expected behavior: Ideally, I would have expected the usual configure system exploration and file generation to occur.

Actual behavior:

% ./configure
configure: error: cannot find sources (config.h.in) in . or ..
% autoreconf
Can't exec "aclocal": No such file or directory at /usr/share/autoconf/Autom4te/FileUtils.pm line 326.
autoreconf: failed to run aclocal: No such file or directory

Solution On my system, I had an autoconf package installed, but lacked automake. After installing that, I got further:

% autoreconf
configure.ac:11: error: required file './compile' not found
configure.ac:11:   'automake --add-missing' can install 'compile'
configure.ac:8: error: required file './install-sh' not found
configure.ac:8:   'automake --add-missing' can install 'install-sh'
configure.ac:8: error: required file './missing' not found
configure.ac:8:   'automake --add-missing' can install 'missing'
parallel-tests: error: required file './test-driver' not found
parallel-tests:   'automake --add-missing' can install 'test-driver'
src/Makefile.am: error: required file './depcomp' not found
src/Makefile.am:   'automake --add-missing' can install 'depcomp'
autoreconf: automake failed with exit status: 1

Executing automake --add-missing as suggested generated the remaining missing files, allowing configure to run to successful completion.

I don't think this is necessarily a problem with Austin. I think Manjaro is more user-focused than many other Linux distros (I switched to it from Ubuntu to try out a different - better? - UI) and doesn't always install everything a developer might expect to be present straight out of the box. I know I've installed a bunch of packages since spinning up Manjaro, much of which I don't recall needing to do on Ubuntu. I've never used Arch, upon which Manjaro is based, so can't comment on whether or not autoconf/automake packages would be installed by default. I do recall installing autoconf a while ago (no longer remember the context), but for whatever reason that was all I needed at that point.

Perhaps all that's needed is to amend the Build section of the docs to indicate that some systems might require installation of autoconf and/or automake packages along with execution of automake --add-missing. An alternative might be to include the necessary auxiliary files needed by configure so new users could just execute

git clone ...
configure && make

Feature request: Integrate Austin with python debugging functions in vscode extension

Description of feature request

For debugging larger python programs (that aren't just one-off executions) it would be excellent if Austin integrated with the vscode debugger and you could step over a function and have an Austin flamegraph profile after the function execution is done.

A command like "Austin: Step Over" would be a good API. "Austin: Step Out" would be nice as well. Or even "Austin: Run until next breakpoint".

If these were non-invasive enough, I would consider replacing the native debugger calls with these.

austin-tui raises exception: _curses.error: init_pair() returned ERR

Description

Trying to run austin against existing python3 process running in a docker container raises an exception with curses initialization.

Steps to Reproduce

  1. Run target app in docker container

  2. Run austin-tui and pass PID

$ docker-compose exec app bash -c "austin-tui -p 1"
  1. See exception

Expected behavior:
Seeing TUI screen

Actual behavior:

Traceback (most recent call last):
  File "/usr/local/bin/austin-tui", line 11, in <module>
    sys.exit(main())
  File "/usr/local/lib/python3.6/site-packages/austin/main.py", line 23, in main
    curses.wrapper(lambda scr: curses_app(scr, parsed_args))
  File "/usr/local/lib/python3.6/curses/__init__.py", line 94, in wrapper
    return func(stdscr, *args, **kwds)
  File "/usr/local/lib/python3.6/site-packages/austin/main.py", line 23, in <lambda>
    curses.wrapper(lambda scr: curses_app(scr, parsed_args))
  File "/usr/local/lib/python3.6/site-packages/austin/main.py", line 9, in curses_app
    with AustinTUI(scr) as austin_tui:
  File "/usr/local/lib/python3.6/site-packages/austin/tui.py", line 333, in __enter__
    curses.init_pair(color, *values)
_curses.error: init_pair() returned ERR

Reproduces how often:

100%

Versions

$ dc exec app bash -c "austin --version"
austin 1.0.1
$ dc exec app bash -c "lsb_release -a"
No LSB modules are available.
Distributor ID:	Debian
Description:	Debian GNU/Linux 9.9 (stretch)
Release:	9.9
Codename:	stretch

Using the extension

Description

Is there a way to run Austin with sudo on MacOS using the VS Code extension? I'm able to run Austin from the terminal directly, but when attempting to run it with sudo using the following script, I get the error message austin process exited with code 1.

{
"label": "pytest with austin",
"type": "austin",
"command": ["sudo"],
"args": [
"${workspaceRoot}/.venv/bin/python",
"-m",
"pytest",
"-k",
""TEST NAME""],
"problemMatcher": []
},

Expected behavior: I'd expect Austin to run the task with sudo (the only way to run it in MacOS) and pipe it to the flamegraph viz.

Actual behavior: Exits with austin process exited with code 1.

Reproduces how often: Every time.

Versions

Version 3.3.0. MacOS 12.3 (Monterey)

Thanks for your help!

Unable to compile

Description

Unable to compile

Steps to Reproduce

  1. Clone the repo at revision 679a896
  2. run gcc -O3 -Wall -pthread src/*.c -o src/austin

Expected behavior:

Compilation should run

Actual behavior:

The following error shows up:

› gcc -O3 -Wall -DDEBUG -pthread src/*.c -o src/austin
src/py_proc.c: In function ‘py_proc__sample’:
src/py_proc.c:918:44: warning: ‘current_thread’ may be used uninitialized in this function [-Wmaybe-uninitialized]
         if (self->py_runtime_raddr != NULL && current_thread == (void *) -1) {
                                            ^

Reproduces how often: 100%

Please update Ubuntu repo's with new Austin version.

Description

Very old version on Ubuntu repository 20.10 (1.0.1)
Or create a PPA would be nice too!

Steps to Reproduce

  1. apt install
  2. austin --version
  3. read the version "1.0.1"

Expected behavior: Need new version with --pipe

Actual behavior: Old version.

Reproduces how often: Every time.

Versions

1.0.1

No samples collected

Description

[root@plat-sh-data-testing-common-pic-infer-demo001 ~]# austin -p 30932 -mem
              _   _
 __ _ _  _ __| |_(_)_ _
/ _` | || (_-<  _| | ' \
\__,_|\_,_/__/\__|_|_||_| 3.6.0 [gcc 9.4.0]
# austin: 3.6.0
# interval: 100
# mode: memory
# memory: 3879940

🐍 Python version: 3.7.7

^C

duration: 3605829

😣 No samples collected.

version

cmd:

austin -p 30932 -mem
 austin version
              _   _
 __ _ _  _ __| |_(_)_ _
/ _` | || (_-<  _| | ' \
\__,_|\_,_/__/\__|_|_||_| 3.6.0 [gcc 9.4.0]

❌ Cannot launch the given command or it terminated too quickly.

python version:

[root@plat-sh-data-testing-common-pic-infer-demo001 ~]# /proc/30932/exe --version
Python 3.7.7

Windows gcc: invalid application of 'sizeof' to incomplete type 'proc_extra_info'

Description

Compilation fails on Windows 10 18.09 with MSYS MinGW 64bit compilers.

Steps to Reproduce

  1. git clone --depth=1 https://github.com/P403n1x87/austin.git
  2. gcc -O3 -Wall -lpsapi src/*.c -o src/austin

Expected behavior: [What you expect to happen]

Compiles without errors.

Actual behavior: [What actually happens]

Compiles with errors, see below.

Reproduces how often:

Every time.

Versions

Latest master 679a896.

Additional Information

Compilation output:

src/mem.c: In function 'copy_memory':
src/mem.c:82:1: warning: control reaches end of non-void function [-Wreturn-type]
   82 | }
      | ^
src/py_proc.c: In function '_py_proc__get_version':
src/py_proc.c:177:8: warning: implicit declaration of function '_popen'; did you mean 'popen'? [-Wimplicit-function-declaration]
  177 |   fp = _popen(cmd, "r");
      |        ^~~~~~
      |        popen
src/py_proc.c:177:6: warning: assignment to 'FILE *' {aka 'struct __sFILE64 *'} from 'int' makes pointer from integer without a cast [-Wint-conversion]
  177 |   fp = _popen(cmd, "r");
      |      ^
src/py_proc.c:188:3: warning: implicit declaration of function '_pclose'; did you mean 'pclose'? [-Wimplicit-function-declaration]
  188 |   _pclose(fp);
      |   ^~~~~~~
      |   pclose
src/py_proc.c: In function '_py_proc__run':
src/py_proc.c:543:9: warning: implicit declaration of function '_py_proc__init'; did you mean 'py_proc__wait'? [-Wimplicit-function-declaration]
  543 |     if (_py_proc__init(self) == 0)
      |         ^~~~~~~~~~~~~~
      |         py_proc__wait
src/py_proc.c: In function 'py_proc_new':
src/py_proc.c:625:57: error: invalid application of 'sizeof' to incomplete type 'proc_extra_info' {aka 'struct _proc_extra_info'}
  625 |   py_proc->extra = (proc_extra_info *) calloc(1, sizeof(proc_extra_info));
      |                                                         ^~~~~~~~~~~~~~~
src/py_proc.c: In function 'py_proc__start':
src/py_proc.c:720:19: error: 'NULL_DEVICE' undeclared (first use in this function)
  720 |       if (freopen(NULL_DEVICE, "w", stdout) == NULL)
      |                   ^~~~~~~~~~~
src/py_proc.c:720:19: note: each undeclared identifier is reported only once for each function it appears in
src/py_proc.c:721:54: error: expected ')' before 'NULL_DEVICE'
  721 |         log_e("Unable to redirect child's STDOUT to " NULL_DEVICE);
      |                                                      ^~~~~~~~~~~~
      |                                                      )
src/py_proc.c: In function 'py_proc__get_memory_delta':
src/py_proc.c:871:28: warning: implicit declaration of function '_py_proc__get_resident_memory' [-Wimplicit-function-declaration]
  871 |   ssize_t current_memory = _py_proc__get_resident_memory(self);
      |                            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
src/py_proc.c: At top level:
src/py_proc.c:71:12: warning: '_py_proc__check_sym' declared 'static' but never defined [-Wunused-function]
   71 | static int _py_proc__check_sym(py_proc_t *, char *, void *);
      |            ^~~~~~~~~~~~~~~~~~~
src/py_proc_list.c: In function 'py_proc_list__update':
src/py_proc_list.c:295:1: warning: label 'finally' defined but not used [-Wunused-label]
  295 | finally:
      | ^~~~~~~

Python version inference can segfault

Description

[Description of the issue]
When the version is read from libpython, we attempt to execute it. This yields a segfault when the library is not executable.

./libpython3.8d.so.1.0 
Segmentation fault

Steps to Reproduce

Execute a program using libpython 3.8.14.
Attempt to use austin on this program.

Versions

./src/austin --version
austin 3.4.0

Additional Information

A possible solution would be to propose a manual override for the user when this segfault occurs.

Did the 2.0.0 tarball get created multiple times?

I have been investigating issues with Homebrew formulae that don't build properly from source. One of these is austin. This is because the tarball does not have the expected contents (homebrew is very strict about this for security reasons -- it won't use any external resource if its hash doesn't match what was expected)

Anyway, when I try to install I see:

$ brew install -sv austin
==> Downloading https://github.com/P403n1x87/austin/archive/v2.0.0.tar.gz
==> Downloading from https://codeload.github.com/P403n1x87/austin/tar.gz/v2.0.0
##-=#=-#
Error: SHA256 mismatch
Expected: 95d40608bac22b965712dc929143ebc994d44b2eb4782b99ba58a2deb1e38aa1
  Actual: be52b0cb7e0819694929ee525464c903600edd91630ad9c77e486fa38ab934dd

The expected SHA comes from when homebrew updated to 2.0.0 on October 8th (cc @chenrui333 ) --
https://github.com/Homebrew/homebrew-core/pull/62498/files

It looks like October 8th was the release date, yet for some reason the archived release tarball seems to have changed. Did you perhaps rebase your git history or change some other options that might have caused github to recreate the tarball?

No output on MacOS/Python 3.8

Description

When running austin on MacOS, it executes the code I want to run but it doesn't yield any output that can be passed along to flamegraph. Also trying to start austin-tui and austin-web gives errors "Took too long to start.", no matter the value I set for timeout (it doesn't even wait untill the time has passed to raise that error)

Steps to Reproduce

  1. Install austin on MacOS (Catalina, 10.15.4) and using python 3.8 following the instructions from the Readme (using autotools)
  2. Run austin python test.py | echo -> no output, hence there is nothing to pass along to flamegraph
  3. Run austin-tui --timeout=10000 python test.py

Expected behavior:
For 2: Yield output to pass along to flamegraph
For 3: Show the results in tui

Actual behavior:
For 2: Nothing, but script runs as expected
For 3: TUI opens for a short period, then closes and shows error it took to long to start

Reproduces how often:
Always

Versions

  • MacOS 10.15.4
  • Python 3.8
  • Austin 1.0.0

Install via apt prints (null) in help

Description

The default help message shows (null) instead of the name of the binary

Steps to Reproduce

$ sudo apt-get install austin
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following NEW packages will be installed:
  austin
0 upgraded, 1 newly installed, 0 to remove and 19 not upgraded.
Need to get 18.3 kB of archives.
After this operation, 56.3 kB of additional disk space will be used.
Get:1 http://deb.debian.org/debian bullseye/main amd64 austin amd64 1.0.1-2 [18.3 kB]
Fetched 18.3 kB in 1s (25.8 kB/s) 
Selecting previously unselected package austin.
(Reading database ... 33309 files and directories currently installed.)
Preparing to unpack .../austin_1.0.1-2_amd64.deb ...
Unpacking austin (1.0.1-2) ...
Setting up austin (1.0.1-2) ...
Processing triggers for man-db (2.9.4-2) ...
$ austin
Usage: (null) [-aCefms?V] [-i n_us] [-o FILE] [-p PID] [-t n_ms] [--alt-format]
            [--children] [--exclude-empty] [--full] [--interval=n_us]
            [--memory] [--output=FILE] [--pid=PID] [--sleepless]
            [--timeout=n_ms] [--help] [--usage] [--version] command [ARG...]

Windows install from chocolatey doesn't echo anything

Installing austin from chocolatey on Windows installs a binary that doesn't echo or seem to do anything:

> austin -V
> 

None of the example commands work, just doesn't give any output.

Version 3.0.0.

I'm on Windows 11 :-)

PackagesNotFoundError on conda installation

Description

Cannot import austin within conda

Steps to Reproduce

  1. conda install -c conda-forge austin

Expected behavior:
Expect the conda installation to go through

Actual behavior:

PackagesNotFoundError: The following packages are not available from current channels:

Reproduces how often:
forever

Versions

conda 22.9.0

You can get this information from copy and pasting the output of austin --version from the command line. Also, please include the OS and what version
of the OS you're running.
Windows 10 Enterprise 10.0.19044

Additional Information

Insufficient Permissions

Description

When I try to run austin to attach to a process I get Insufficient permissions even if I run with sudo or with root user, or with root user using sudo.
If I try to go the way of sudo setcap cap_sys_ptrace+ep 'which austin', after running this command, when I try to launch austin I get Operation not permitted

Steps to Reproduce

  1. Clone and build austin with gcc
  2. Try to run with sudo using -p either using sudo or setting setcap cap_sys_ptrace+ep

Expected behavior: [What you expect to happen]
austin should start normally

Actual behavior: [What actually happens]
I either get "Insufficient permissions" from austin or Operation not permitted from the OS

Reproduces how often: [What percentage of the time does it reproduce?]
Every time

Versions

You can get this information from copy and pasting the output of austin --version from the command line. Also, please include the OS and what version
of the OS you're running.
austin 3.3.0
Debian GNU/Linux 11 (bullseye)

Additional Information

Any additional information, configuration or data that might be necessary to
reproduce the issue.

austin + flamegraph report erroneous code line numers

A recent flamegraph I made with austin showed a large amount of time was being spent on a line number well beyond the end of my source file. I traced the problem to a function whose keyword arguments are split across lines like so:

def problem_function(A='qa1',
                     B=None):

If the two keyword arguments appear on the same line as with

def problem_function(A='qa1', B=None):

then the results are correct.

Steps to Reproduce

The attached programs, derived from https://github.com/danyaal/mandelbrot/blob/master/mandelbrot.py, illustrate the problem. They differ only in the line split of arguments shown above. I run the two versions with

austin -a -i 50 ./austin_good.py | flamegraph.pl --minwidth 10 --countname=us > flame_good.svg
austin -a -i 50 ./austin_bad.py  | flamegraph.pl --minwidth 10 --countname=us > flame_bad.svg

Expected behavior:
Lines 29 and 27 shown in the flamegraph are correct.
austin_good

Actual behavior:
The bad result suggests a lot of time is spent on line 286--but the file has only 30 lines.
austin_bad

Reproduces how often:
100%

Versions

austin 2.0.0
Python 3.8.3 (Anaconda 2020.07)
Ubuntu 20.04

austin_bad.py.txt
austin_good.py.txt

Chocolatey script needs an update clause

When trying to run choco update austin to update to 3.1.0 I got the following error:

Downloading austin 64 bit
  from 'https://github.com/P403n1x87/austin/releases/download/v3.1.0/austin-3.1.0-win64.msi'
Progress: 100% - Completed download of C:\Users\anthonyshaw\AppData\Local\Temp\chocolatey\austin\3.1.0\austin-3.1.0-win64.msi (292 KB).
Download of austin-3.1.0-win64.msi (292 KB) completed.
Hashes match.
Installing austin...
WARNING: This MSI requires uninstall prior to installing a different version. Please ask the package maintainer(s) to add a check in the chocolateyInstall.ps1 script and uninstall if the software is installed. This is most likely an issue with the 'austin' package and not with Chocolatey itself. Please follow up with the package maintainer(s) directly.
ERROR: Running ["C:\WINDOWS\System32\msiexec.exe" /i "C:\Users\anthonyshaw\AppData\Local\Temp\chocolatey\austin\3.1.0\austin-3.1.0-win64.msi" /qn /norestart /l*v "C:\Users\anthonyshaw\AppData\Local\Temp\chocolatey\austin.3.1.0.MsiInstall.log" ] was not successful. Exit code was '1638'. Exit code indicates the following: This MSI requires uninstall prior to installing a different version. Please ask the package maintainer(s) to add a check in the chocolateyInstall.ps1 script and uninstall if the software is installed. This is most likely an issue with the 'austin' package and not with Chocolatey itself. Please follow up with the package maintainer(s) directly..
The upgrade of austin was NOT successful.
Error while running 'C:\ProgramData\chocolatey\lib\austin\tools\chocolateyinstall.ps1'.
 See log for details.
 Unsuccessful operation for austin.

py3.8: AttributeError: 'NoneType' object has no attribute 'memory'

Description

austin-web -p 5301


/| __ | / /____ /_ ___ |___ __________ /()____ /|
| / __ | /| / / _ _ __ \ __ /| | / / /
/ / / __ \ | /
/
__| __ |/ |/ / / __/ /
/ / _ ___ / /
/ /
(
_ )/ /_ _ / _ / / / /_ |
|/ ____/|
/ _//./ // |_,/ // _/ // // // |/

  • Sampling process with PID 5301 (/usr/bin/python3 ./test1c.py --mod=qpsk,8+8apsk --rate=1/4,26/45 --esno=6.8 --bicm --real --demod-iter=10 --clip=100)
  • Web Austin is running on http://localhost:59115. Press Ctrl+C to stop.
    Error handling request
    Traceback (most recent call last):
    File "/home/nbecker/.local/lib/python3.8/site-packages/aiohttp/web_protocol.py", line 418, in start
    resp = await task
    File "/home/nbecker/.local/lib/python3.8/site-packages/aiohttp/web_app.py", line 458, in _handle
    resp = await handler(request)
    File "/home/nbecker/.local/lib/python3.8/site-packages/austin/web.py", line 170, in handle_websocket
    "metric": "m" if self.args.memory else "t",
    AttributeError: 'NoneType' object has no attribute 'memory'
    [Description of the issue]

Steps to Reproduce

  1. [First Step]
    Start code to be profiled
  2. [Second Step]
    Start austin-web -p pid
  3. [and so on...]
    When web page is opened, above error results

Expected behavior: [What you expect to happen]

Actual behavior: [What actually happens]

Reproduces how often: [What percentage of the time does it reproduce?]

Versions

python3.8, fedora 32 linux

You can get this information from copy and pasting the output of austin --version from the command line. Also, please include the OS and what version
of the OS you're running.

Additional Information

Any additional information, configuration or data that might be necessary to
reproduce the issue.

questions regarding _py_proc_get_version

  1. I wonder why there is this logic

    isvalid(self->lib_path)
    What's the lib_path expected there? And how could it be runnable with a "-V" option? In one of my special environment which is I admit somewhat different from a normal Linux environment, it goes to this place and it thinks lib_path to be some libpython3.Xm.so, which somehow has executable permisson, and runnig the lib file with -V gets a core dump. In contrast in a normal Linux environment, libpython3.X so files are not executable.

  2. This place

    strstr(self->lib_path, "python"), "python%d.%d", &major, &minor
    it's better to find "python" from reverse instead of strstr. In my special environment my libpython so file is under a directory which has "python" in its path, so this logic fails.

fail to infer tid offset

Description

I got this issue in one of my environment, which must be somewhat different from a normal one although I don't know what exactly could cause this. Under this envionment Austin gets no samples, and I debugged a little bit and see _pthread_tid_offset is 0 here

if (unlikely(_pthread_tid_offset == 0))

I believe it won't reproduce on a normal Linux system. Here I only would like to see if you could have any ideas how I can further investigate it in my environment.

Versions

3.1.0

Additional Information

both austin-web and austin-tui don't accept -m flag

Description

austin-web -p 17118 -m
usage: austin-web [-h] [-a] [-e] [-i INTERVAL] [-p PID] [-s] [-t TIMEOUT]
[command] [args [args ...]]
austin-web: error: unrecognized arguments: -m

[Description of the issue]

Steps to Reproduce

  1. [First Step]
  2. [Second Step]
  3. [and so on...]

Expected behavior: [What you expect to happen]
I expected -m would be passed to austin to give memeory profile

Actual behavior: [What actually happens]

Reproduces how often: [What percentage of the time does it reproduce?]

Versions

You can get this information from copy and pasting the output of austin --version from the command line. Also, please include the OS and what version
of the OS you're running.

Additional Information

Any additional information, configuration or data that might be necessary to
reproduce the issue.

a number of exceptions (trying sample quit process, etc) thrown while trying austin-tui -C -m -l on shortlived process

version information

austin itself installed from debian

$> which austin ; apt-cache policy austin
/usr/bin/austin
austin:
  Installed: 1.0.1-2
  Candidate: 1.0.1-2
  Version table:
 *** 1.0.1-2 600
        600 http://http.debian.net/debian sid/main amd64 Packages
        100 /var/lib/dpkg/status
     1.0.0-1 900
        900 http://deb.debian.org/debian bullseye/main amd64 Packages

but it is a bare C tool without any python tui, etc. So I cloned this repo at current state of

$> git describe
fatal: No annotated tags can describe '679a89676c3b5cb17a1766a9e5c4a3f335ddc495'.
However, there were unannotated tags: try --tags.

$> git describe --tags
v1.0.1-1-g679a896

I am trying austin-tui in a virtualenv into which I also installed datalad, which I'd like to profile... commands were

(git)lena:~/proj/misc/austin[master]git
$> py=3; d=venvs/dev$py; virtualenv --python=python$py --system-site-packages $d && source $d/bin/activate && pip3 install -e .
$> pip install datalad   

running

$> venvs/dev3/bin/austin-tui -C -m -l -- /home/yoh/proj/misc/austin/venvs/dev3/bin/datalad --help

results in nothing really visible in tui (not surprising -- short lived process) and coming back to terminal with following tracebacks

$> venvs/dev3/bin/austin-tui -C -m -l -- /home/yoh/proj/misc/austin/venvs/dev3/bin/datalad --help
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/psutil/_common.py", line 340, in wrapper
    ret = self._cache[fun]
AttributeError: _cache

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/psutil/_pslinux.py", line 1517, in wrapper
    return fun(self, *args, **kwargs)
  File "/usr/lib/python3/dist-packages/psutil/_common.py", line 343, in wrapper
    return fun(self)
  File "/usr/lib/python3/dist-packages/psutil/_pslinux.py", line 1559, in _parse_stat_file
    with open_binary("%s/%s/stat" % (self._procfs_path, self.pid)) as f:
  File "/usr/lib/python3/dist-packages/psutil/_common.py", line 604, in open_binary
    return open(fname, "rb", **kwargs)
FileNotFoundError: [Errno 2] No such file or directory: '/proc/966126/stat'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/yoh/proj/misc/austin/austin/tui.py", line 596, in start
    self.run(self._scr)
  File "/home/yoh/proj/misc/austin/austin/tui.py", line 575, in run
    task.result()
  File "/home/yoh/proj/misc/austin/austin/tui.py", line 558, in update_loop
    self.get_child("cpu_plot").push(self.get_current_cpu())
  File "/home/yoh/proj/misc/austin/austin/tui.py", line 388, in get_current_cpu
    value = int(self.austin.get_child().cpu_percent())
  File "/usr/lib/python3/dist-packages/psutil/__init__.py", line 1112, in cpu_percent
    pt2 = self._proc.cpu_times()
  File "/usr/lib/python3/dist-packages/psutil/_pslinux.py", line 1517, in wrapper
    return fun(self, *args, **kwargs)
  File "/usr/lib/python3/dist-packages/psutil/_pslinux.py", line 1710, in cpu_times
    values = self._parse_stat_file()
  File "/usr/lib/python3/dist-packages/psutil/_pslinux.py", line 1524, in wrapper
    raise NoSuchProcess(self.pid, self._name)
psutil.NoSuchProcess: psutil.NoSuchProcess process no longer exists (pid=966126)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "venvs/dev3/bin/austin-tui", line 11, in <module>
    load_entry_point('python-austin', 'console_scripts', 'austin-tui')()
  File "/home/yoh/proj/misc/austin/austin/main.py", line 23, in main
    curses.wrapper(lambda scr: curses_app(scr, parsed_args))
  File "/usr/lib/python3.8/curses/__init__.py", line 105, in wrapper
    return func(stdscr, *args, **kwds)
  File "/home/yoh/proj/misc/austin/austin/main.py", line 23, in <lambda>
    curses.wrapper(lambda scr: curses_app(scr, parsed_args))
  File "/home/yoh/proj/misc/austin/austin/main.py", line 10, in curses_app
    austin_tui.start(args)
  File "/home/yoh/proj/misc/austin/austin/tui.py", line 600, in start
    self.austin.join()
  File "/home/yoh/proj/misc/austin/austin/__init__.py", line 274, in join
    return self._loop.run_until_complete(self._start_task)
  File "/usr/lib/python3.8/asyncio/base_events.py", line 616, in run_until_complete
    return future.result()
  File "/home/yoh/proj/misc/austin/austin/__init__.py", line 236, in _start
    self._callback(data.decode("ascii").rstrip())
  File "/home/yoh/proj/misc/austin/austin/tui.py", line 349, in on_sample_received
    self.stats.add_thread_sample(line.encode())
  File "/home/yoh/proj/misc/austin/austin/stats.py", line 13, in atomic_wrapper
    result = f(*args, **kwargs)
  File "/home/yoh/proj/misc/austin/austin/stats.py", line 134, in add_thread_sample
    sample_stack = SampledFrame(frames, duration, 1) if frames else None
  File "/home/yoh/proj/misc/austin/austin/stats.py", line 34, in __init__
    self.children = [SampledFrame(data[2:], duration, height + 1)]
  File "/home/yoh/proj/misc/austin/austin/stats.py", line 34, in __init__
    self.children = [SampledFrame(data[2:], duration, height + 1)]
  File "/home/yoh/proj/misc/austin/austin/stats.py", line 34, in __init__
    self.children = [SampledFrame(data[2:], duration, height + 1)]
  [Previous line repeated 66 more times]
  File "/home/yoh/proj/misc/austin/austin/stats.py", line 31, in __init__
    self.line_number = data[1][1:]
IndexError: list index out of range

Can't trace a program running inside docker container by pid or ppid

Description

Hi, before going further, allow me to clarify that maybe this issue seems to be somewhat similar to(not very sure) - Tracing a program running inside docker container may fail #159. Ahh, I've read all the conversations between yours. You've solved the issue metioned by that author. But my situation is a little different from him.

I also have an application running inside the docker container and want to profile it by pid. Through the htop and ps -ef command, I record the pid and parent pid. When I use <austin -Cp> or <austin -p> [pip] to display the stack of the frames it fails.

              _   _
 __ _ _  _ __| |_(_)_ _
/ _` | || (_-<  _| | ' \
\__,_|\_,_/__/\__|_|_||_| 3.6.0 [gcc 9.4.0]

Parent process
👽 Not a Python process.

🚼 It looks like you are trying to profile a process that is not a Python
process, and that has not spawned any child Python processes. Make sure that
you are targeting the right application.

Versions

austin: 3.6.0
os:

NAME="CentOS Linux"
VERSION="7 (Core)"
ID="centos"

Additional Information

Based on this minor issue, I switched over to py-spy. py-spy is worked for me. It can retrieve the information by the pid and parent pid. - For example, py-spy top -p 22227 will show:

Collecting samples from '/usr/local/bin/python /usr/local/bin/uvicorn energy_api.main:app --host 0.0.0.0 --port 9000' (python v3.8.18)
Total Samples 1623
GIL: 100.00%, Active: 100.00%, Threads: 1

  %Own   %Total  OwnTime  TotalTime  Function (filename)
 39.13%  47.83%    4.16s     4.68s   pslq (mpmath/identification.py)
  0.00%   0.00%    2.86s     2.86s   get_values (pandas/core/internals/blocks.py)
...

I can't put my finger on what the underlying cause is. If I missed something, please let me know. THX.

Can't run script with local package import

I'm able to profile from a sample script (simple for loop) to test the pipeline is working, e.g.

sudo austin -i 1ms --pipe python test-lang.py > sample_test.austin

But when I actually use this for my use case: a script that imports a local package, I got ModuleNotFoundError, see below:

➜ sudo austin -i 100 --pipe /Users/stefanhg/opt/anaconda3/envs/llm-ie-gen/bin/python "/Users/stefanhg/Documents/Georgia Tech/Research/LLM fo
r IE Data Gen/LLM-Data-Gen-IE/chore/generate.py" > generate.austin
Traceback (most recent call last):
  File "/Users/stefanhg/Documents/Georgia Tech/Research/LLM for IE Data Gen/LLM-Data-Gen-IE/chore/generate.py", line 2, in <module>
    from src.util import *
ModuleNotFoundError: No module named 'src'

Profiling API bottlenecks/behavior inside docker container

Description

Hi,

I'm trying to find out why some API's in my product are acting slow on random occasions. Usually they respond to a call in under a second but sometimes the response time is considerably longer.

I'm running austin inside a docker container and using the command instructed in the manual:
austin -Cp "pgrep apache2 | head -n 1" -x 30
and then calling the API's from Insomnia.
That produces data for 6 PIDs which then converted into flamegraph looks like this:

image

So my question would be that is there a way to get more in-depth data out of those processes, because this does not really help me?
Any advice is appreciated. Thanks!

Versions

austin 2.0.0
Debian GNU/Linux 9

Segfault with powerpc64le

Description

I try to run the test.py example on a powerpc architecture.

Steps to Reproduce

  1. Download and unpack powerpc64le.tar.xz or build from source.
  2. Run ./austin python3 test.py
  3. segfault ☠️ An unexpected error occurred...

Expected behavior:
austin output in stdout or output file
Actual behavior:
sh: line 1: 6229 Segmentation fault (core dumped) /software/opt/python/3.6.8/lib/libpython3.6m.so.1.0 -V 2>&1
Reproduces how often: 100

Versions

austin 2.1.1
linux 4.19

Additional Information

The segfault could be caused by a mix of python versions.
The system loads python 3 with module load python.
I noticed some commands explicitly need python3 as a parameter or they will use python 2.
I can not find the log files.

Insufficient permissions message on Austin usage command on macOS

Description

I installed austin using brew and am encountering a permissions issue. I saw that there is a sudo setcap cap_sys_ptrace+ep `which austin step, but I skipped it setcap isn't available on macOS and I'm unsure of what to execute instead.

[Description of the issue]

Steps to Reproduce

  1. brew install austin
  2. sudo austin

Expected behavior: Austin launches

Actual behavior:
Error message:

            [--alt-format] [--children] [--exclude-empty] [--full]
            [--interval=n_us] [--memory] [--output=FILE] [--pid=PID]
            [--sleepless] [--timeout=n_ms] [--exposure=n_sec] [--help]
            [--usage] [--version] command [ARG...]

              _   _      
 __ _ _  _ __| |_(_)_ _  
/ _` | || (_-<  _| | ' \ 
\__,_|\_,_/__/\__|_|_||_|
🤓 austin version: 2.0.0

🔒 Insufficient permissions. Austin requires the use of sudo on Mac OS or
that your user is in the procmod group in order to read the memory of even
its child processes. Furthermore, the System Integrity Protection prevents
Austin from working with Python binaries installed in certain areas of the
file system. See

    🌐 https://github.com/P403n1x87/austin#compatibility

for more details.

Reproduces how often: 100%

Error: Interpreter state search timed out

hi,

i'm trying to use austin inside a docker container, but i'm getting the error:

Interpreter state search timed out

see here:

root@775795f76490:~# top

top - 00:38:13 up 13 min,  0 users,  load average: 0.06, 0.13, 0.09
Tasks:  14 total,   1 running,  13 sleeping,   0 stopped,   0 zombie
%Cpu(s):  0.1 us,  0.2 sy,  0.0 ni, 99.7 id,  0.0 wa,  0.0 hi,  0.0 si,  0.0 st
MiB Mem :   3936.1 total,    372.0 free,    779.1 used,   2785.1 buff/cache
MiB Swap:   1024.0 total,   1024.0 free,      0.0 used.   2908.4 avail Mem 

  PID USER      PR  NI    VIRT    RES    SHR S  %CPU  %MEM     TIME+ COMMAND                                     
   13 root      20   0  856924  34348  13836 S   0.3   0.9   0:00.76 python3                                     
   19 root      20   0  235736  99024  16952 S   0.3   2.5   0:01.32 jamovi-engine                               
    1 root      20   0    2608    604    536 S   0.0   0.0   0:00.03 sh                                          
    8 root      20   0   58052   1712     44 S   0.0   0.0   0:00.00 nginx                                       
    9 www-data  20   0   58052   3504   1560 S   0.0   0.1   0:00.00 nginx                                       
   10 www-data  20   0   58052   3504   1560 S   0.0   0.1   0:00.00 nginx                                       
   11 www-data  20   0   58052   3504   1560 S   0.0   0.1   0:00.00 nginx                                       
   12 www-data  20   0   58052   3504   1560 S   0.0   0.1   0:00.00 nginx                                       
   15 root      20   0  235740  98876  16800 S   0.0   2.5   0:01.31 jamovi-engine                               
   17 root      20   0  235736  99032  16956 S   0.0   2.5   0:01.33 jamovi-engine                               
   21 root      20   0  235744  99068  16988 S   0.0   2.5   0:01.32 jamovi-engine                               
root@775795f76490:~# austin -p 13
Interpreter state search timed out
root@775795f76490:~# 

any tips?

with thanks

Profiling mod_wsgi applications

Description

Profiling mod_wsgi applications would be great. pyflame supports this out of the box: just point it at an Apache process ID.

Steps to Reproduce

  1. get Apache process ID
  2. run austin -p $pid

Expected behavior: austin samples the mod_wsgi application as if it were a normal Python process.

Actual behavior: austin returns "Python binary not found. Not Python?"

Versions

0.6.1-beta on Ubuntu 18.04.

Can't run Austin against pyenv python distribution

Description

Struggling to get Austin running against pytest on MacOS due to what I am currently assuming is missing debug symbols in my python. I've reduced this to a minimal test case below.

Steps to Reproduce

  1. Install python via pyenv
  2. Run austin python -c "from time import sleep;sleep(4)"

Expected behavior: Austin starts process and outputs profiling data.

Actual behavior: Austin tells me It looks like you are trying to profile a process that is not a Python process.

Reproduces how often: 100%

Versions

austin 3.5.0 (via homebrew)
macOS 13.4.1 on a 2019 MacBookPro (Intel)
Python (various, all from pyenv)

Additional Information

When installing a version of python the build process seems to pull in libraries from various places so I wonder if this is the variable that is causing this to fail. This is the output from building 3.8.16:

❯ pyenv install 3.8.16
python-build: use [email protected] from homebrew
python-build: use readline from homebrew
Downloading Python-3.8.16.tar.xz...
-> https://www.python.org/ftp/python/3.8.16/Python-3.8.16.tar.xz
Installing Python-3.8.16...
python-build: use tcl-tk from homebrew
python-build: use readline from homebrew
python-build: use zlib from xcode sdk
Installed Python-3.8.16 to /Users/sihil/.pyenv/versions/3.8.16

This is an example run:

❯ austin --version
austin 3.5.0

❯ pyenv versions
  system
  3.8.6
  3.8.10
  3.8.10/envs/document-enhancement
* 3.8.16 (set by /Users/sihil/.python-version)
  3.9.11
  3.10.12
  document-enhancement --> /Users/sihil/.pyenv/versions/3.8.10/envs/document-enhancement

❯ python --version
Python 3.8.16

❯ austin python -c "from time import sleep;sleep(4)"
              _   _
 __ _ _  _ __| |_(_)_ _
/ _` | || (_-<  _| | ' \
\__,_|\_,_/__/\__|_|_||_| 3.5.0 [GCC 4.2.1]

👾 It looks like you are trying to profile a process that is not a Python
process. Make sure that you are targeting the right application. If the Python
process is actually a child of the target process then use the -C option to
discover it automatically.

❯ nm -gD /Users/sihil/.pyenv/versions/3.8.16/lib/libpython3.8.dylib
/Library/Developer/CommandLineTools/usr/bin/nm: error: /Users/sihil/.pyenv/versions/3.8.16/lib/libpython3.8.dylib: File format has no dynamic symbol table

Sampler associated time delta instead of number of samples

Description

The value associated with each stack sample is the time difference between the current sample and the previous one (in microseconds):

static int
_py_proc__sample(py_proc_t * py_proc) {
  ctime_t   delta     = gettime() - t_sample;
  // [...]
  _print_collapsed_stack(py_thread, delta, mem_delta >> 10);
  // [...]
  t_sample += delta;
}

This is different from what is expected from flamegraph and what is generated by (most?) flamegraph stackcollapse tools: they expecte/generate sample counts.

As a consequence, when passed to FlameGraph, the number of samples in the SVG is not correct.

I tyhink it would be more correct (and least suprising) to report the number of samples (by default). Alternatively, the behavious should be documented (and possibly and option to report by sample counts could be added).

Steps to Reproduce

Versions

Additional Information

Problem on MacOS

Description

I'm unable to get Austin (3.2.0) to run on MacOS 12.0.1

I've installed it via brew. And running it as follows:

sudo austin python example.py

This is in a venv within my home folder.

Austin reports:


🔒 Insufficient permissions. Austin requires the use of sudo on Mac OS in order
to read the memory of even its child processes. Furthermore, the System
Integrity Protection prevents Austin from working with Python binaries
installed in certain areas of the file system. See

    🌐 https://github.com/P403n1x87/austin#compatibility

for more details.

Happy to help with testing.

an unexpected error occured

Description

austin -p 3496982
_ _
__ _ _ _ | |()_ _
/ ` | || (-< | | ' \
_
,|_,/
/_|||||
🤓 austin version: 2.1.1
sh: line 1: 3497149 Segmentation fault (core dumped) /home/nbecker/phasenoise_inroute/dot2x1.cpython-39-x86_64-linux-gnu.so -V 2>&1

☠️ An unexpected error occurred. Please report the issue to

🌐 https://github.com/P403n1x87/austin/issues

How do I find these logs?
This is fedora 33 linux.

Did not get desired results | `🐢 Long sampling rate : 80722/83336 (96.86 %) samples took longer than the sampling interval`

Description

I try to profile my Python script using Austin but fail. I

Steps to Reproduce

  1. Create python script:
import pandas as pd
from sklearn.model_selection import train_test_split
from sklearn.linear_model import LinearRegression
from sklearn.preprocessing import StandardScaler
from sklearn.ensemble import RandomForestRegressor
import numpy as np

from memory_profiler import profile
#fp=open('memory_profile.log','w+')
@profile()
def import_data():
    data=pd.read_csv("kc_house_data.csv")
    data=data.drop(["id","date"],axis=1)
    data["sqft_above"].fillna(1788.39,inplace=True)
    return data
    #data.describe()

@profile()
def parse_data(data):
    Y=data["price"].va[What actually happens]lues
    Y=np.log(Y)
    features=data.columns
    X1=list(set(features)-set(["price"]))
    X=data[X1].values
    ss=StandardScaler()
    X=ss.fit_transform(X)
    return X,Y

@profile()
def linearRegressionfit(Xt,Yt,Xts,Yts):
    lr=LinearRegression()
    model=lr.fit(Xt,Yt)
    predict=lr.predict(Xts)

    print("train Accuracy",lr.score(Xt,Yt))
    print("test Accuracy",lr.score(Xts,Yts))

@profile()
def randForestRegressorfit(Xt,Yt,Xts,Yts):
    regr = RandomForestRegressor(n_estimators=100,max_features='auto',max_depth=80 ,min_samples_leaf=1
                                 ,min_samples_split=2,random_state=0)
    model=regr.fit(Xt,Yt)
    predict=regr.predict(Xts)
    print("train Accuracy : ",regr.score(Xt,Yt))
    print("test Accuracy : ",regr.score(Xts,Yts))


if __name__ == '__main__':
    data = import_data()
    X, Y = parse_data(data)
    Xt,Xts,Yt,Yts=train_test_split(X,Y,test_size=0.4,random_state=0)
    linearRegressionfit(Xt,Yt,Xts,Yts)

    randForestRegressorfit(Xt,Yt,Xts,Yts)
    linearRegressionfit(Xt,Yt,Xts,Yts)
  1. Get the dataset from kc_house_data.zip

  2. Run the code: $ austin -i 50 python main.py | FlameGraph/flamegraph.pl > my_script_profile.svg

Expected behavior: CPU usage and other profiliing stats are saved/plotted on a flamegraph

Actual behavior: Got an error:

🕑 Sampling time (min/avg/max) : 1/257/8625 us
🐢 Long sampling rate : 80722/83336 (96.86 %) samples took longer than the sampling interval
💀 Error rate : 0/83336 (0.00 %) invalid samples

Reproduces how often: 100%

Versions

Austin: 1.0.1
OS: Ubuntu 18.04.4 LTS

"Cannot determine the version of the Python interpreter" on Windows

Description

I'm trying to use Austin on Windows. I installed it, I have it on my PATH. When trying to use it to profile a simple Python script, I get the error in the title. I believe I'm pointing Austin to an actual Python executable, not to the py wrapper.

What am I doing wrong?

Steps to Reproduce

  1. Install latest Austin via MSI binary.
  2. Create a test.py script with the following contents:
total = 0
for i in range(1001):
    total += i
print(total)
  1. Open commandline Terminal and run the following in the script's dir:
> austin --pipe "C:\Program Files\Python39\python.exe" test.py

Expected behavior: successful execution of script and some useful output from Austin for post-processing.

Actual behavior: Austin complains with the following:

🔢 Cannot determine the version of the Python interpreter. This could be due
to the binary not being an actual Python binary, like uWSGI. Please report an
issue at

    🌐 https://github.com/P403n1x87/austin/issues

together with details about the application that you were trying to profile,
like frameworks used, command line etc ....

Reproduces how often: 100%

Versions

Python 3.9.6

austin 3.1.0

Windows 10:
Edition Windows 10 Pro
Version 21H2
OS build 19044.1387

Additional Information

Other command variations I've tried out of desperation:

> austin -C --pipe "C:\Program Files\Python39\python.exe" test.py

Response:

👽 Not a Python process.

🚼 It looks like you are trying to profile a process that is not a Python
process, and that has not spawned any child Python processes. Make sure that
you are targeting the right application.

And another:

> austin -C "C:\Program Files\Python39\python.exe" test.py

Response:

�[1m              _   _      �[0m
�[1m __ _ _  _ __| |_(_)_ _  �[0m
�[1m/ _` | || (_-<  _| | ' \ �[0m
�[1m\__,_|\_,_/__/\__|_|_||_|�[0m �[36;1m3.1.0�[0m

�[1mParent process�[0m
👽 Not a Python process.

🚼 It looks like you are trying to profile a process that is not a Python
process, and that has not spawned any child Python processes. Make sure that
you are targeting the right application.

austin-tui seems to be unable to profile complex application

Description

It seems impossible to profile larger applications with tui that require startup with subcommands.

austin-tui  ./project/main.py startexpensiveprocess --userdir ../ ...

This simply fails with the following error.

austin-tui: error: unrecognized arguments: --userdir ../ 

This suggests that somehow the arguments are not recognized to belong to the subcommand (most likely because it's 2 positional commands instead of the expected one)

Expected behavior: Profiling of the running python application

Actual behavior: not working

Reproduces how often: always

Versions

You can get this information from copy and pasting the output of austin --version from the command line. Also, please include the OS and what version
of the OS you're running.

austin 2.0.0
Archlinux

Austin doesn't work with Speedscope anymore?

Description

With austin=2.1.1 the austin output could be uploaded directly to Speedscope, but this broke with 3.0

Steps to Reproduce

  1. conda install austin==3.1
  2. austin -o austin_3_1.txt python -c 'import this'
  3. upload austin_3_1.txt to speedscope

Expected behavior: Speedscope displays flamegraph, just like with austin==2.1.1

Actual behavior: "Unrecognized format! See documentation about supported formats."

Reproduces how often: 100%

Is this expected behaviour? I realize that there is a austin2speedscope CLI tool, but from the README it sounds like using it is optional. I couldn't figure out a way to pipe to austin2speedscope.

I really like using austin and speedscope, but having a necessary conversion step is a bit unpractical. Ideally I'd like it for speedscope to directly support the new format. Other options would be a flag eg austin --speedscope-format or allowing piping to austin2speedscope. With the current versions I have 2 very large profiling outputs on disk, one in the original format, one in the speedscope format.

(I didn't know where to open this issue, I hope here is fine).

Sample for n seconds

It's not clear if there is currently a way to do this, but if I haven't missed something, it would be nice to have an argument that specified that you wanted to sample for n seconds. The use case that I'm thinking of is that I have a process that's running over a long period of time and I want to attach to it for some short period, sample, and then stop sampling and then pipe this to flamegraph:

austin -p 2712 -s | ./flamegraph.pl  > profile.svg &

Pyflame and py-spy hav a flag for this, which I found to be quite useful.

Tracing a program running inside docker container may fail

Description

Hi, Gabriele.
Below is my understanding of the problem, please tell me where I am wrong.
Austin is trying to get python interpreter path by reading proc/maps.
When running inside a docker container, that file will contain paths that are relative to the container, and those paths make sense only inside the container.

Austin will then try to check that file using the path on the host system here:
on the host system

Steps to Reproduce

Run any python program inside the docker container, and trace it with Austin. I will provide exact steps if needed, but I wanted to hear your thoughts first.

Expected behavior: Not sure... Allow Austin to specify the path to the interpreter, somehow expose the interpreter from the container to the host, and then manually let austin know which interpreter to use?
My use case is actually even more trickier: I wanted to run Austin from a container(with host PID namespace and admin privileges), to trace a program in another container...
Somehow it works with https://github.com/benfred/py-spy, but I haven't dug into how it works...

Actual behavior:

  • If python interpreters on the host and in the container are the same, it will work(I guess)
  • If the container's python version does not exist on the host, Austin will fail with the "not a python process" message
  • If the python path exists both on the host and in the container(e.g. /usr/bin/python3.7), but their versions are different, Austin will produce an empty output.

Versions

Latest Austin version from github. Ubuntu 18 for the host system, Ubuntu 18 inside the container.

Austin is not using the correct process ID on macOS

Description

Austin is not using the correct process ID when emitting samples

Steps to Reproduce

Run Austin on macOS and collect samples

Expected behavior: Austin uses the correct PID

Actual behavior: Austin seems to use a mach_port_t instead.

Reproduces how often: Always

Versions

Austin 2.1.1

Additional Information

N. A.

Link to MSI from readme

I was looking how to install Austin on Windows. I never used Chocolatey or Scoop before, and I tried to install them but they required PowerShell, and the commands they gave me resulted in errors.

I looked at your Releases page and was happy to see that there's an MSI installer there. That is a much more widely accepted format. I wish the readme stated there's an MSI installer and linked to it. It would have saved me a bunch of time I spent searching, and would likely save others the same.

no stack whatsoever in TUI

Description

I only see

 Austin  TUI  Memory Profile
  _________   PPID 968515 CMD /home/yoh/proj/misc/austin/venvs/dev3/bin/python /home/yoh/proj/misc/austin/venvs/dev3/bin/datalad install -s /// /tmp/in
stallhere_⎠   PID:TID 968515:7fde87514    1  of   2   CPU     0%     ▁      
              Samples        2  Duration      07"     MEM    34M    ▂███████
  OWN    TOTAL    %OWN   %TOTAL  FUNCTION                                                                                                              
     0       4    0.00%  11.76%  _find_and_load (<frozen importlib._bootstrap>)   

on some runs... on some other it stays empty entirely (until finishing up and showing #51 upon exit).

running regular austin (rm -rf /tmp/installhere; austin -C -m /home/yoh/proj/misc/austin/venvs/dev3/bin/datalad install -s /// /tmp/installhere) produces lots of reasonable output showing a nice flamegraph if passed to

Steps to Reproduce

Here is the script

#!/bin/bash

PS4='> '
set -xeu

cd "$(mktemp -d ${TMPDIR:-/tmp}/dl-XXXXXXX)"
pwd
# sudo apt-get install git git-annex
git clone https://github.com/P403n1x87/austin

cd austin
py=3; d=venvs/dev$py; virtualenv --python=python$py --system-site-packages $d && source $d/bin/activate && pip3 install -e .
pip install datalad
cd ..
austin-tui -C -l -m austin/venvs/dev3/bin/datalad install ///

and interesting part is that on the first run -- it showed some stack... in full mode it became even more sensible... upon reruns -- success varied, and often I just had the <frozen... one only. (BTW -- may be those could be hidden unless in full mode? probably coming up due to virtualenv )

anyways -- most likely related to #51 , I will leave a comment there now with some more details

austinp only builds on systems with a patched libbfd

Description

libbfd is weird. The upstream version of bfd.h contains the following:

/* PR 14072: Ensure that config.h is included first.  */
#if !defined PACKAGE && !defined PACKAGE_VERSION
#error config.h must be included before this header
#endif

This has been reported at least twice (1 2) to upstream binutils, and closed as WONTFIX because binutils maintainers think it should be every downstream user's problem to comply with that weird PACKAGE/PACKAGE_VERSION define requirement.

It happens that several Linux distros carry downstream patches to remove this part of the bfd.h header, which allows austinp to build on those systems. That includes Debian (and derivatives) as well as Fedora (who also qualified the behavior as "clearly wrong"...). Unfortunately, this is not universally carried by distros: Arch and NixOS don't carry this patch (though I'm looking at adding it to NixOS now).

To allow austinp to build on more Linux distributions, it would be good to have a workaround for this. It could be as easy as what perf is currently doing: https://elixir.bootlin.com/linux/latest/source/tools/perf/util/srcline.c#L132

If you're fine with that I'm happy to send a PR to add that "#define PACKAGE" before bfd.h includes, but I suspect it will be faster for you to just make the commit :) just let me know.

Steps to Reproduce

  1. Build austinp on a Linux distro that does not carry the aforementioned bfd.h patch. Arch or NixOS are widely used distros that fit this criteria.

Expected behavior: austinp is able to use the system's unpatched bfd.h

Actual behavior: compilation error:

#error config.h must be included before this header

Reproduces how often: 100%

Versions

3.4.1

Additional Information

n/a

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.