austin-python 2.2.0__tar.gz → 2.4.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {austin_python-2.2.0 → austin_python-2.4.0}/PKG-INFO +2 -2
- austin_python-2.4.0/austin/events.py +165 -0
- {austin_python-2.2.0 → austin_python-2.4.0}/austin/format/mojo.py +519 -14
- {austin_python-2.2.0 → austin_python-2.4.0}/austin/stats.py +12 -4
- austin_python-2.4.0/test/format/test_mojo.py +855 -0
- {austin_python-2.2.0 → austin_python-2.4.0}/test/stats/test_austin_stats.py +54 -0
- austin_python-2.2.0/austin/events.py +0 -101
- austin_python-2.2.0/test/format/test_mojo.py +0 -235
- {austin_python-2.2.0 → austin_python-2.4.0}/.flake8 +0 -0
- {austin_python-2.2.0 → austin_python-2.4.0}/.gitignore +0 -0
- {austin_python-2.2.0 → austin_python-2.4.0}/.readthedocs.yml +0 -0
- {austin_python-2.2.0 → austin_python-2.4.0}/AUTHORS +0 -0
- {austin_python-2.2.0 → austin_python-2.4.0}/CODE-OF-CONDUCT.md +0 -0
- {austin_python-2.2.0 → austin_python-2.4.0}/CONTRIBUTING.md +0 -0
- {austin_python-2.2.0 → austin_python-2.4.0}/COPYING +0 -0
- {austin_python-2.2.0 → austin_python-2.4.0}/ISSUE_TEMPLATE.md +0 -0
- {austin_python-2.2.0 → austin_python-2.4.0}/LICENSE.md +0 -0
- {austin_python-2.2.0 → austin_python-2.4.0}/MANIFEST.in +0 -0
- {austin_python-2.2.0 → austin_python-2.4.0}/PULL_REQUEST_TEMPLATE.md +0 -0
- {austin_python-2.2.0 → austin_python-2.4.0}/README.md +0 -0
- {austin_python-2.2.0 → austin_python-2.4.0}/austin/__init__.py +0 -0
- {austin_python-2.2.0 → austin_python-2.4.0}/austin/aio.py +0 -0
- {austin_python-2.2.0 → austin_python-2.4.0}/austin/base.py +0 -0
- {austin_python-2.2.0 → austin_python-2.4.0}/austin/cli.py +0 -0
- {austin_python-2.2.0 → austin_python-2.4.0}/austin/config.py +0 -0
- {austin_python-2.2.0 → austin_python-2.4.0}/austin/errors.py +0 -0
- {austin_python-2.2.0 → austin_python-2.4.0}/austin/format/__init__.py +0 -0
- {austin_python-2.2.0 → austin_python-2.4.0}/austin/format/collapsed_stack.py +0 -0
- {austin_python-2.2.0 → austin_python-2.4.0}/austin/format/compress.py +0 -0
- {austin_python-2.2.0 → austin_python-2.4.0}/austin/format/mojo_compress.py +0 -0
- {austin_python-2.2.0 → austin_python-2.4.0}/austin/format/pprof/__init__.py +0 -0
- {austin_python-2.2.0 → austin_python-2.4.0}/austin/format/pprof/__main__.py +0 -0
- {austin_python-2.2.0 → austin_python-2.4.0}/austin/format/pprof/profile.proto +0 -0
- {austin_python-2.2.0 → austin_python-2.4.0}/austin/format/pprof/profile_pb2.py +0 -0
- {austin_python-2.2.0 → austin_python-2.4.0}/austin/format/speedscope.py +0 -0
- {austin_python-2.2.0 → austin_python-2.4.0}/austin/simple.py +0 -0
- {austin_python-2.2.0 → austin_python-2.4.0}/austin/threads.py +0 -0
- {austin_python-2.2.0 → austin_python-2.4.0}/austin/tools/diff.py +0 -0
- {austin_python-2.2.0 → austin_python-2.4.0}/austin/tools/mojodbg.py +0 -0
- {austin_python-2.2.0 → austin_python-2.4.0}/austin/tools/resolve.py +0 -0
- {austin_python-2.2.0 → austin_python-2.4.0}/pyproject.toml +0 -0
- {austin_python-2.2.0 → austin_python-2.4.0}/test/__init__.py +0 -0
- {austin_python-2.2.0 → austin_python-2.4.0}/test/conftest.py +0 -0
- {austin_python-2.2.0 → austin_python-2.4.0}/test/data/austin.json +0 -0
- {austin_python-2.2.0 → austin_python-2.4.0}/test/data/austin.out +0 -0
- {austin_python-2.2.0 → austin_python-2.4.0}/test/data/austin.pprof +0 -0
- {austin_python-2.2.0 → austin_python-2.4.0}/test/data/austinp.mojo +0 -0
- {austin_python-2.2.0 → austin_python-2.4.0}/test/data/austinp.resolved.mojo +0 -0
- {austin_python-2.2.0 → austin_python-2.4.0}/test/data/column.mojo +0 -0
- {austin_python-2.2.0 → austin_python-2.4.0}/test/data/column.py +0 -0
- {austin_python-2.2.0 → austin_python-2.4.0}/test/data/diff_a-b.austin +0 -0
- {austin_python-2.2.0 → austin_python-2.4.0}/test/data/diff_a.austin +0 -0
- {austin_python-2.2.0 → austin_python-2.4.0}/test/data/diff_b.austin +0 -0
- {austin_python-2.2.0 → austin_python-2.4.0}/test/data/mp.austin +0 -0
- {austin_python-2.2.0 → austin_python-2.4.0}/test/data/mp.mojo +0 -0
- {austin_python-2.2.0 → austin_python-2.4.0}/test/data/repeat.austin +0 -0
- {austin_python-2.2.0 → austin_python-2.4.0}/test/data/repeat.mojo +0 -0
- {austin_python-2.2.0 → austin_python-2.4.0}/test/data/test.austin +0 -0
- {austin_python-2.2.0 → austin_python-2.4.0}/test/data/test.mojo +0 -0
- {austin_python-2.2.0 → austin_python-2.4.0}/test/format/__init__.py +0 -0
- {austin_python-2.2.0 → austin_python-2.4.0}/test/format/test_compress.py +0 -0
- {austin_python-2.2.0 → austin_python-2.4.0}/test/format/test_mojo_compress.py +0 -0
- {austin_python-2.2.0 → austin_python-2.4.0}/test/format/test_pprof.py +0 -0
- {austin_python-2.2.0 → austin_python-2.4.0}/test/format/test_speedscope.py +0 -0
- {austin_python-2.2.0 → austin_python-2.4.0}/test/stats/test_austin_file_reader.py +0 -0
- {austin_python-2.2.0 → austin_python-2.4.0}/test/stats/test_hierarchical_stats.py +0 -0
- {austin_python-2.2.0 → austin_python-2.4.0}/test/test_aio.py +0 -0
- {austin_python-2.2.0 → austin_python-2.4.0}/test/test_base.py +0 -0
- {austin_python-2.2.0 → austin_python-2.4.0}/test/test_cli.py +0 -0
- {austin_python-2.2.0 → austin_python-2.4.0}/test/test_config.py +0 -0
- {austin_python-2.2.0 → austin_python-2.4.0}/test/test_semver.py +0 -0
- {austin_python-2.2.0 → austin_python-2.4.0}/test/test_simple.py +0 -0
- {austin_python-2.2.0 → austin_python-2.4.0}/test/test_threads.py +0 -0
- {austin_python-2.2.0 → austin_python-2.4.0}/test/tools/test_diff.py +0 -0
- {austin_python-2.2.0 → austin_python-2.4.0}/test/tools/test_resolve.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
2
|
Name: austin-python
|
|
3
|
-
Version: 2.
|
|
3
|
+
Version: 2.4.0
|
|
4
4
|
Summary: Python wrapper for Austin, the CPython frame stack sampler.
|
|
5
5
|
Project-URL: homepage, https://github.com/P403n1x87/austin-python
|
|
6
6
|
Project-URL: documentation, https://austin-python.readthedocs.io
|
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
import typing as t
|
|
2
|
+
from dataclasses import dataclass
|
|
3
|
+
|
|
4
|
+
ProcessId = int
|
|
5
|
+
ThreadName = str
|
|
6
|
+
InterpreterId = int
|
|
7
|
+
MicroSeconds = int
|
|
8
|
+
Bytes = int
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
@dataclass(frozen=True)
|
|
12
|
+
class AustinFrame:
|
|
13
|
+
"""Python frame."""
|
|
14
|
+
|
|
15
|
+
filename: str
|
|
16
|
+
function: str
|
|
17
|
+
line: int
|
|
18
|
+
line_end: t.Optional[int] = None
|
|
19
|
+
column: t.Optional[int] = None
|
|
20
|
+
column_end: t.Optional[int] = None
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
@dataclass(frozen=True)
|
|
24
|
+
class AustinMetrics:
|
|
25
|
+
"""Austin metric."""
|
|
26
|
+
|
|
27
|
+
time: t.Optional[MicroSeconds] = None
|
|
28
|
+
memory: t.Optional[Bytes] = None
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
@dataclass(frozen=True)
|
|
32
|
+
class AustinEvent:
|
|
33
|
+
"""Base class for Austin events."""
|
|
34
|
+
|
|
35
|
+
pass
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
@dataclass(frozen=True)
|
|
39
|
+
class AustinMetadata(AustinEvent):
|
|
40
|
+
"""Austin metadata."""
|
|
41
|
+
|
|
42
|
+
name: str
|
|
43
|
+
value: str
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
@dataclass(frozen=True)
|
|
47
|
+
class AustinTask:
|
|
48
|
+
"""A node in an asyncio task tree (3.14+ only).
|
|
49
|
+
|
|
50
|
+
``frames`` is this task's last-known position: its coroutine chain if it
|
|
51
|
+
was suspended, or the frames it was running if it was running.
|
|
52
|
+
``awaiting`` are the tasks this task is itself awaiting, i.e. the tasks
|
|
53
|
+
for which this task is the direct waiter.
|
|
54
|
+
|
|
55
|
+
This is the structure of the tree only. The time tasks spend at their
|
|
56
|
+
positions is carried by AustinTaskReport (see AustinSample.task_reports)
|
|
57
|
+
and, while they are running, by the samples they are running at (see
|
|
58
|
+
AustinSample.running_task).
|
|
59
|
+
"""
|
|
60
|
+
|
|
61
|
+
task_id: int
|
|
62
|
+
name: t.Optional[str]
|
|
63
|
+
frames: t.Tuple[AustinFrame, ...] = ()
|
|
64
|
+
awaiting: t.Tuple["AustinTask", ...] = ()
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
@dataclass(frozen=True)
|
|
68
|
+
class AustinTaskReport:
|
|
69
|
+
"""A report of a task's position (3.14+ only).
|
|
70
|
+
|
|
71
|
+
Austin only reports a task's position when it has changed. ``frames`` is
|
|
72
|
+
the task's new position, and ``elapsed`` is how long the task was
|
|
73
|
+
*suspended* at its ``previous`` one, which this report replaces -- the
|
|
74
|
+
earliest point at which that duration could be known at all. Austin
|
|
75
|
+
doesn't report it: readers work it out as the time of the task's thread's
|
|
76
|
+
samples while the task held that position without running. It is await
|
|
77
|
+
time only: the time a task spends running is the time of the samples it
|
|
78
|
+
is running at (see AustinSample.running_task). Always 0 in CPU mode, where
|
|
79
|
+
a suspended task uses no CPU.
|
|
80
|
+
|
|
81
|
+
``previous`` is None on a task's first report, which has no previous
|
|
82
|
+
position (and so ``elapsed`` is 0). A report with no ``frames`` closes the
|
|
83
|
+
task: it is gone, and ``elapsed`` is the time at its last position. At the
|
|
84
|
+
end of a stream, each task still alive gets a report with ``frames`` equal
|
|
85
|
+
to ``previous``, carrying the time it has spent at its position since.
|
|
86
|
+
|
|
87
|
+
Each report is attached to exactly one sample, so summing ``elapsed``
|
|
88
|
+
over every sample's reports counts each duration once.
|
|
89
|
+
"""
|
|
90
|
+
|
|
91
|
+
task_id: int
|
|
92
|
+
name: t.Optional[str]
|
|
93
|
+
frames: t.Tuple[AustinFrame, ...]
|
|
94
|
+
previous: t.Optional[t.Tuple[AustinFrame, ...]]
|
|
95
|
+
elapsed: MicroSeconds
|
|
96
|
+
|
|
97
|
+
@property
|
|
98
|
+
def closing(self) -> bool:
|
|
99
|
+
"""Whether this report closes the task."""
|
|
100
|
+
return not self.frames
|
|
101
|
+
|
|
102
|
+
|
|
103
|
+
@dataclass(frozen=True)
|
|
104
|
+
class AustinSample(AustinEvent):
|
|
105
|
+
"""Austin sample."""
|
|
106
|
+
|
|
107
|
+
Key = t.Tuple[
|
|
108
|
+
ProcessId,
|
|
109
|
+
t.Optional[InterpreterId],
|
|
110
|
+
ThreadName,
|
|
111
|
+
t.Optional[t.Tuple[AustinFrame, ...]],
|
|
112
|
+
t.Optional[bool],
|
|
113
|
+
t.Optional[bool],
|
|
114
|
+
]
|
|
115
|
+
|
|
116
|
+
pid: ProcessId
|
|
117
|
+
iid: t.Optional[InterpreterId]
|
|
118
|
+
thread: ThreadName
|
|
119
|
+
metrics: AustinMetrics
|
|
120
|
+
frames: t.Optional[t.Tuple[AustinFrame, ...]] = None
|
|
121
|
+
gc: t.Optional[bool] = None
|
|
122
|
+
idle: t.Optional[bool] = None
|
|
123
|
+
# The live tasks owned by this sample's thread, as of this sample.
|
|
124
|
+
tasks: t.Tuple[AustinTask, ...] = ()
|
|
125
|
+
# The task reports that came with this sample, each one exactly once.
|
|
126
|
+
task_reports: t.Tuple[AustinTaskReport, ...] = ()
|
|
127
|
+
# The task this sample's thread was running, if any. The sample's metrics
|
|
128
|
+
# then belong to that task too, at its latest position (see AustinTask).
|
|
129
|
+
running_task: t.Optional[int] = None
|
|
130
|
+
|
|
131
|
+
def key(
|
|
132
|
+
self,
|
|
133
|
+
) -> "AustinSample.Key":
|
|
134
|
+
"""Return a key for this sample."""
|
|
135
|
+
return (
|
|
136
|
+
self.pid,
|
|
137
|
+
self.iid,
|
|
138
|
+
self.thread,
|
|
139
|
+
self.frames,
|
|
140
|
+
self.gc,
|
|
141
|
+
self.idle,
|
|
142
|
+
)
|
|
143
|
+
|
|
144
|
+
@classmethod
|
|
145
|
+
def from_key_and_metrics(
|
|
146
|
+
cls, key: "AustinSample.Key", metrics: AustinMetrics
|
|
147
|
+
) -> "AustinSample":
|
|
148
|
+
"""Create a sample from a key."""
|
|
149
|
+
return cls(
|
|
150
|
+
pid=key[0],
|
|
151
|
+
iid=key[1],
|
|
152
|
+
thread=key[2],
|
|
153
|
+
frames=key[3],
|
|
154
|
+
gc=key[4],
|
|
155
|
+
idle=key[5],
|
|
156
|
+
metrics=metrics,
|
|
157
|
+
)
|
|
158
|
+
|
|
159
|
+
|
|
160
|
+
class AustinEventIterator:
|
|
161
|
+
"""Base class for Austin event iterators."""
|
|
162
|
+
|
|
163
|
+
def __iter__(self) -> t.Iterator[AustinEvent]:
|
|
164
|
+
"""Return an iterator over Austin events."""
|
|
165
|
+
raise NotImplementedError("Subclasses must implement __iter__ method.")
|