GithubHelp home page GithubHelp logo

austin-python's Introduction

Synopsis

Gabriele has a curiosity that's hard to appease. Since a early age he's always been intrigued by Science and Nature and wanted to know more about its fundamental laws. Together with his taste for abstraction as a way to find order and rigour in things, he embarked on an adventure to learn about Physics and Mathematics. He likes Technology very much too, a trait you could have guessed if you had the chance to see him crack open any gizmos he came across to see what was inside and understand how they worked.

Changelog

2016 - Upgrade to PhD Pure Mathematics

2011 - Upgrade to MSc Theoretical Physics

2009 - Upgrade to BSc Physics

1987 - Initial release

Publications

A list of all my academic publications can be found on arxiv.org.

I maintain The Hub of Heliopolis, a blog where I collect the notes of my experiments with technology.

I'm also the author of the following books

Main Projects

Currently, my main project is Austin, a frame stack sampler for CPython which can be used to build powerful statistical profilers for Python applications that don't require instrumentation and have minimal impact on the application runtime, making it ideal for profiling in production.

Contributions

My work on Austin is helping developing the profiling interface of Python. See my contributions to CPython for more details.

Growth

I always wanted to learn about Machine Learning and in 2018 I started exploring its mathematical fundamentals. You can find my personal take in my book The Mathematical Foundations of Machine Learning.

My project Marvin collects some code that I wrote as part of my experiments and applications of ML techniques that I have used to solve certain problems.

Stats

GitHub Stats
GitHub Stats
Top Language


GitHub Pages LinkedIn Stack Exchange Twitter wikipedia

visits repos gists

austin-python's People

Contributors

delroth avatar goxberry avatar p403n1x87 avatar sparrowt avatar

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

Watchers

 avatar  avatar  avatar

austin-python's Issues

test_threaded_bad_options not expected to raise AustinError?

Description

On my system test_threaded_bad_options does not pass, instead failing due to an AustinError. I don't really understand how this test is supposed to work right now, it's by design trying to make austin fail to start, but doesn't assert that an exception was raised.

This is unlike test_simple_bad_options and test_async_bad_options which both have a with raises(AustinError).

IMO this should also have a with raises(AustinError), but that raises the question of why the test is currently passing in your CI environment and not on my local system... My local setup is slightly weird (I'm working on packaging austin, austin-python and austin-tui for NixOS) but looking at the code I don't understand how this could not fail.

Steps to Reproduce

  1. (probably some unknown preconditions which are met on my system but not on CI)
  2. pytest

Expected behavior: All tests pass.

Actual behavior: test_threaded_bad_options is the only failure, with the following stack trace:

============================= test session starts ==============================
platform linux -- Python 3.10.7, pytest-7.1.3, pluggy-1.0.0
rootdir: /build/source
collected 61 items / 3 deselected / 58 selected

test/test_aio.py .....                                                   [  8%]
test/test_cli.py ........                                                [ 22%]
test/test_config.py ..                                                   [ 25%]
test/test_semver.py ......                                               [ 36%]
test/test_simple.py ......                                               [ 46%]
test/test_threads.py ...F                                                [ 53%]
test/format/test_compress.py ..                                          [ 56%]
test/format/test_mojo.py ...                                             [ 62%]
test/format/test_pprof.py .                                              [ 63%]
test/format/test_speedscope.py ...                                       [ 68%]
test/stats/test_austin_file_reader.py .                                  [ 70%]
test/stats/test_austin_stats.py ....                                     [ 77%]
test/stats/test_frame.py ....                                            [ 84%]
test/stats/test_hierarchical_stats.py ...                                [ 89%]
test/stats/test_sample.py ....                                           [ 96%]
test/tools/test_diff.py s                                                [ 98%]
test/tools/test_resolve.py x                                             [100%]

=================================== FAILURES ===================================
__________________________ test_threaded_bad_options ___________________________

    def test_threaded_bad_options():
        austin = TestThreadedAustin(terminate_callback=lambda *args: None)
        austin.start(["-I", "1000", "python", "-c", "for i in range(1000000): print(i)"])
>       austin.join()

test/test_threads.py:124:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
austin/threads.py:106: in join
    raise self._exc
austin/threads.py:75: in _thread_bootstrap
    SimpleAustin.start(self, args)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <test.test_threads.TestThreadedAustin object at 0x7ffff620d8a0>
args = ['-I', '1000', 'python', '-c', 'for i in range(1000000): print(i)']

    def start(self, args: List[str] = None) -> None:
        """Start the Austin process."""
        try:
            self.proc = subprocess.Popen(
                [self.binary_path] + ["-P"] + (args or sys.argv[1:]),
                stdout=subprocess.PIPE,
                stderr=subprocess.PIPE,
            )
        except FileNotFoundError:
            raise AustinError("Austin executable not found.") from None

        if not self.proc.stdout:
            raise AustinError("Standard output stream is unexpectedly missing")
        if not self.proc.stderr:
            raise AustinError("Standard error stream is unexpectedly missing")

        try:
            if not self._read_meta():
>               raise AustinError("Austin did not start properly")
E               austin.AustinError: Austin did not start properly

austin/simple.py:96: AustinError
=============================== warnings summary ===============================
test/test_aio.py::test_async_time
  /build/source/test/test_aio.py:76: DeprecationWarning: There is no current event loop
    asyncio.get_event_loop().run_until_complete(

test/test_aio.py::test_async_memory
  /build/source/test/test_aio.py:103: DeprecationWarning: There is no current event loop
    asyncio.get_event_loop().run_until_complete(

test/test_aio.py::test_async_terminate
  /build/source/test/test_aio.py:133: DeprecationWarning: There is no current event loop
    asyncio.get_event_loop().run_until_complete(

test/test_aio.py::test_async_bad_options
  /build/source/test/test_aio.py:155: DeprecationWarning: There is no current event loop
    asyncio.get_event_loop().run_until_complete(

test/format/test_mojo.py: 200000 warnings
  /nix/store/fkcl1wzq3106qqgl84bhgk1lp56q6bzg-python3-3.10.7/lib/python3.10/random.py:370: DeprecationWarning: non-integer arguments to randrange() have been deprecated since Python 3.10 and will be removed in a subsequent version
    return self.randrange(a, b+1)

-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
=========================== short test summary info ============================
FAILED test/test_threads.py::test_threaded_bad_options - austin.AustinError: ...
= 1 failed, 55 passed, 1 skipped, 3 deselected, 1 xfailed, 200004 warnings in 15.64s =

Reproduces how often: 100% on my system, but that's not particularly helpful to you :)

Versions

Python 3.10, austin 3.4.1, austin-python 1.4.1.

Additional Information

n/a

Strict requirement on protobuf/toml versions?

Description

This came up in conda-forge/austin-python-feedstock#13 . Currently, austin-python has quite strict requirements on the versions of the protobuf and toml packages (from pyproject.toml):

  "protobuf~=3.12.2",
  [...]
  "toml~=0.10.2",

Are these versions required, or can we use newer versions of protobuf and toml?

Steps to Reproduce

n/a

Expected behavior: [What you expect to happen]

Actual behavior: [What actually happens]

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

Versions

1.5.0

Additional Information

n/a

Generated trace files cannot be converted to .json with austin2speedscope

Description

Generated trace files cannot be converted to .json with austin2speedscope

Steps to Reproduce

  1. Run austin to generate trace: .\austin -o output.austin -C py conway.py
  2. Run austin2speedscope: austin2speedscope.exe .\output.austin output.json

Expected behavior: Data should be converted into JSON

Actual behavior: The resulting file is almost completely empty:

{"$schema": "https://www.speedscope.app/file-format-schema.json", "shared": {"frames": []}, "profiles": [], "name": "output.austin", "exporter": "Austin2Speedscope Converter 0.2.0"}

Reproduces how often: 100% of the time

Versions

austin 3.0.0

Additional Information

Running in a Python 3.8 venv on Microsoft Windows [Version 10.0.19043.1110]

The raw trace file is 17MB in size (not sure if that's to be expected)

austin2speedscope with child process tracking generates a bogus graph

Description

Steps to Reproduce

  1. Clone https://github.com/pypa/pip and checkout b551c09c4ef21c675a46504b4883d897b4b82f33
  2. Create a virtual environment.
  3. pip install -e .
  4. sudo austin -C -o profile.austin python -m pip install --dry-run pyrax==1.9.8
  5. austin2speedscope profile.austin profile-austin.json

Expected behavior:

A valid speedscope JSON file is generated, that renders the collected contents in a detailed flamegraph.

Actual behavior:

What seems like not particularly useful Thread._bootstrap calls.

Screenshot 2023-10-23 at 23 44 51

Notably, the file does contain the relevant information that seems appropriate for format but it doesn't seem to be in the correct representation for speedscope to consider rendering it.

Reproduces how often:

100%, so far.

Versions

❯ austin --version                                    
austin 3.6.0
❯ austin2speedscope --version                         
0.2.1
❯ system_profiler SPSoftwareDataType
Software:

    System Software Overview:

      System Version: macOS 13.6 (22G120)
      Kernel Version: Darwin 22.6.0
      Boot Volume: Macintosh HD
      Boot Mode: Normal
      Computer Name: M1 MacBook Air
      User Name: Pradyun Gedam (pradyunsg)
      Secure Virtual Memory: Enabled
      System Integrity Protection: Enabled
      Time since boot: 16 days, 7 minutes

Additional Information

Relevant profile.austin file is 1.3GB.

Code uses KiloBytes for memory metrics but values are bytes

Description

Code like this https://github.com/P403n1x87/austin-python/blob/main/austin/stats.py#L109 suggests that the sample metrics for memory are stored in KB. However:

Admittedly the readme only explicitly says it's bytes in --memory mode, and is ambiguous for --full, but the behaviour I've observed is that it's measured in bytes in the full case too.

There's no observably wrong behaviour from code in this repo AFAICS, the issue is just confusion when reading the code.

I think simply renaming the KiloBytes custom type to Bytes would clarify matters? (I've speculatively opened #29)

Key Error: mode when running either austin2speedscope or austin2pprof on windows 10

Description

upon running either austin2speedcope.exe input.austin output.speedscope or austin2pprof.exe input.austin output.pprof I run into the following error:

  File "<pythonpath>\LocalCache\local-packages\Python310\site-packages\austin\format\speedscope.py", line 212, in main
    mode = fin.metadata["mode"]
KeyError: 'mode'

Steps to Reproduce

  1. generate a austin profile via austin -P .\.venv\Scripts\python.exe launch.py 1>wall_time.austin
  2. run either command to convert the file to another format

Expected behavior: [What you expect to happen]

conversion happens and new file is created
Actual behavior: [What actually happens]
command errors out with a stacktrace ending in the above message

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

Versions

PS > austin --version
austin 3.5.0
PS > austin2pprof.exe --version
0.1.0
PS > austin-compress.exe --version
0.2.0
PS > austin2speedscope.exe --version
0.2.1
PS > python --version
Python 3.10.10

this is on windows 10

Additional Information

this seems related to the Metadata class inside stats.py.
mode is one of the metadata fields listed at the top of the austin output file (in the output from the command in the steps to reproduce the line reads # mode: wall

Adding cProfile (pstat) conversion

I want to use the PyCharm cProfile visualiser to view Austin-generated profiles.

It requires pstat files generated from the pstats stdlib module. I'm about to write that feature and submit a PR.

If you've already written this please let me know!

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.