austin-python 2.1.1__tar.gz → 2.1.2__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.1.1 → austin_python-2.1.2}/PKG-INFO +1 -1
- {austin_python-2.1.1 → austin_python-2.1.2}/austin/events.py +1 -2
- {austin_python-2.1.1 → austin_python-2.1.2}/austin/format/mojo.py +21 -2
- {austin_python-2.1.1 → austin_python-2.1.2}/austin/stats.py +18 -15
- {austin_python-2.1.1 → austin_python-2.1.2}/pyproject.toml +4 -4
- {austin_python-2.1.1 → austin_python-2.1.2}/test/stats/test_austin_stats.py +16 -16
- {austin_python-2.1.1 → austin_python-2.1.2}/.flake8 +0 -0
- {austin_python-2.1.1 → austin_python-2.1.2}/.gitignore +0 -0
- {austin_python-2.1.1 → austin_python-2.1.2}/.readthedocs.yml +0 -0
- {austin_python-2.1.1 → austin_python-2.1.2}/AUTHORS +0 -0
- {austin_python-2.1.1 → austin_python-2.1.2}/CODE-OF-CONDUCT.md +0 -0
- {austin_python-2.1.1 → austin_python-2.1.2}/CONTRIBUTING.md +0 -0
- {austin_python-2.1.1 → austin_python-2.1.2}/COPYING +0 -0
- {austin_python-2.1.1 → austin_python-2.1.2}/ISSUE_TEMPLATE.md +0 -0
- {austin_python-2.1.1 → austin_python-2.1.2}/LICENSE.md +0 -0
- {austin_python-2.1.1 → austin_python-2.1.2}/MANIFEST.in +0 -0
- {austin_python-2.1.1 → austin_python-2.1.2}/PULL_REQUEST_TEMPLATE.md +0 -0
- {austin_python-2.1.1 → austin_python-2.1.2}/README.md +0 -0
- {austin_python-2.1.1 → austin_python-2.1.2}/austin/__init__.py +0 -0
- {austin_python-2.1.1 → austin_python-2.1.2}/austin/aio.py +0 -0
- {austin_python-2.1.1 → austin_python-2.1.2}/austin/base.py +0 -0
- {austin_python-2.1.1 → austin_python-2.1.2}/austin/cli.py +0 -0
- {austin_python-2.1.1 → austin_python-2.1.2}/austin/config.py +0 -0
- {austin_python-2.1.1 → austin_python-2.1.2}/austin/errors.py +0 -0
- {austin_python-2.1.1 → austin_python-2.1.2}/austin/format/__init__.py +0 -0
- {austin_python-2.1.1 → austin_python-2.1.2}/austin/format/collapsed_stack.py +1 -1
- {austin_python-2.1.1 → austin_python-2.1.2}/austin/format/compress.py +0 -0
- {austin_python-2.1.1 → austin_python-2.1.2}/austin/format/pprof/__init__.py +0 -0
- {austin_python-2.1.1 → austin_python-2.1.2}/austin/format/pprof/__main__.py +0 -0
- {austin_python-2.1.1 → austin_python-2.1.2}/austin/format/pprof/profile.proto +0 -0
- {austin_python-2.1.1 → austin_python-2.1.2}/austin/format/pprof/profile_pb2.py +0 -0
- {austin_python-2.1.1 → austin_python-2.1.2}/austin/format/speedscope.py +0 -0
- {austin_python-2.1.1 → austin_python-2.1.2}/austin/simple.py +0 -0
- {austin_python-2.1.1 → austin_python-2.1.2}/austin/threads.py +0 -0
- {austin_python-2.1.1 → austin_python-2.1.2}/austin/tools/diff.py +0 -0
- {austin_python-2.1.1 → austin_python-2.1.2}/austin/tools/mojodbg.py +0 -0
- {austin_python-2.1.1 → austin_python-2.1.2}/austin/tools/resolve.py +0 -0
- {austin_python-2.1.1 → austin_python-2.1.2}/test/__init__.py +0 -0
- {austin_python-2.1.1 → austin_python-2.1.2}/test/conftest.py +0 -0
- {austin_python-2.1.1 → austin_python-2.1.2}/test/data/austin.json +0 -0
- {austin_python-2.1.1 → austin_python-2.1.2}/test/data/austin.out +0 -0
- {austin_python-2.1.1 → austin_python-2.1.2}/test/data/austin.pprof +0 -0
- {austin_python-2.1.1 → austin_python-2.1.2}/test/data/austinp.mojo +0 -0
- {austin_python-2.1.1 → austin_python-2.1.2}/test/data/austinp.resolved.mojo +0 -0
- {austin_python-2.1.1 → austin_python-2.1.2}/test/data/column.mojo +0 -0
- {austin_python-2.1.1 → austin_python-2.1.2}/test/data/column.py +0 -0
- {austin_python-2.1.1 → austin_python-2.1.2}/test/data/diff_a-b.austin +0 -0
- {austin_python-2.1.1 → austin_python-2.1.2}/test/data/diff_a.austin +0 -0
- {austin_python-2.1.1 → austin_python-2.1.2}/test/data/diff_b.austin +0 -0
- {austin_python-2.1.1 → austin_python-2.1.2}/test/data/mp.austin +0 -0
- {austin_python-2.1.1 → austin_python-2.1.2}/test/data/mp.mojo +0 -0
- {austin_python-2.1.1 → austin_python-2.1.2}/test/data/test.austin +0 -0
- {austin_python-2.1.1 → austin_python-2.1.2}/test/data/test.mojo +0 -0
- {austin_python-2.1.1 → austin_python-2.1.2}/test/format/__init__.py +0 -0
- {austin_python-2.1.1 → austin_python-2.1.2}/test/format/test_compress.py +0 -0
- {austin_python-2.1.1 → austin_python-2.1.2}/test/format/test_mojo.py +0 -0
- {austin_python-2.1.1 → austin_python-2.1.2}/test/format/test_pprof.py +0 -0
- {austin_python-2.1.1 → austin_python-2.1.2}/test/format/test_speedscope.py +0 -0
- {austin_python-2.1.1 → austin_python-2.1.2}/test/stats/test_austin_file_reader.py +0 -0
- {austin_python-2.1.1 → austin_python-2.1.2}/test/stats/test_hierarchical_stats.py +0 -0
- {austin_python-2.1.1 → austin_python-2.1.2}/test/test_aio.py +0 -0
- {austin_python-2.1.1 → austin_python-2.1.2}/test/test_cli.py +0 -0
- {austin_python-2.1.1 → austin_python-2.1.2}/test/test_config.py +0 -0
- {austin_python-2.1.1 → austin_python-2.1.2}/test/test_semver.py +0 -0
- {austin_python-2.1.1 → austin_python-2.1.2}/test/test_simple.py +0 -0
- {austin_python-2.1.1 → austin_python-2.1.2}/test/test_threads.py +0 -0
- {austin_python-2.1.1 → austin_python-2.1.2}/test/tools/test_diff.py +0 -0
- {austin_python-2.1.1 → austin_python-2.1.2}/test/tools/test_resolve.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: austin-python
|
|
3
|
-
Version: 2.1.
|
|
3
|
+
Version: 2.1.2
|
|
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
|
|
@@ -277,7 +277,12 @@ def str_reader() -> t.Generator[t.Optional[str], bytes, str]:
|
|
|
277
277
|
(b,) = yield bytes(buffer[:i]).decode(errors="replace")
|
|
278
278
|
i = 0
|
|
279
279
|
else:
|
|
280
|
-
|
|
280
|
+
try:
|
|
281
|
+
buffer[i] = b
|
|
282
|
+
except IndexError:
|
|
283
|
+
# Expand the buffer if needed
|
|
284
|
+
buffer += bytearray(i - len(buffer) + 1)
|
|
285
|
+
buffer[i] = b
|
|
281
286
|
(b,) = yield None
|
|
282
287
|
i += 1
|
|
283
288
|
|
|
@@ -353,6 +358,14 @@ class BaseMojoStreamReader(AustinEventIterator):
|
|
|
353
358
|
|
|
354
359
|
return metadata
|
|
355
360
|
|
|
361
|
+
@property
|
|
362
|
+
def mode(self) -> t.Optional[str]:
|
|
363
|
+
return self.metadata.get("mode")
|
|
364
|
+
|
|
365
|
+
@property
|
|
366
|
+
def gc(self) -> t.Optional[str]:
|
|
367
|
+
return self.metadata.get("gc")
|
|
368
|
+
|
|
356
369
|
def _finalize_sample(self) -> AustinSample:
|
|
357
370
|
"""Finalize the current sample."""
|
|
358
371
|
assert self._running_sample is not None, self._running_sample
|
|
@@ -395,7 +408,13 @@ class BaseMojoStreamReader(AustinEventIterator):
|
|
|
395
408
|
if self._running_sample is not None:
|
|
396
409
|
self._finalize_sample()
|
|
397
410
|
|
|
398
|
-
self._running_sample = _RunningSample(
|
|
411
|
+
self._running_sample = _RunningSample(
|
|
412
|
+
pid=pid,
|
|
413
|
+
iid=iid,
|
|
414
|
+
thread=thread,
|
|
415
|
+
idle=False if self.mode == "full" else None,
|
|
416
|
+
gc=False if self.gc is not None else None,
|
|
417
|
+
)
|
|
399
418
|
|
|
400
419
|
return MojoStack(pid, iid if iid is not None else -1, thread)
|
|
401
420
|
|
|
@@ -21,6 +21,7 @@
|
|
|
21
21
|
# You should have received a copy of the GNU General Public License
|
|
22
22
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
23
23
|
|
|
24
|
+
from collections import namedtuple
|
|
24
25
|
from copy import deepcopy
|
|
25
26
|
from dataclasses import dataclass
|
|
26
27
|
from dataclasses import field
|
|
@@ -39,10 +40,12 @@ from austin.events import AustinMetadata
|
|
|
39
40
|
from austin.events import AustinMetrics
|
|
40
41
|
from austin.events import AustinSample
|
|
41
42
|
from austin.events import ProcessId
|
|
42
|
-
from austin.events import ThreadName
|
|
43
43
|
from austin.format.collapsed_stack import AustinEventCollapsedStackFormatter
|
|
44
44
|
|
|
45
45
|
|
|
46
|
+
ThreadInfo = namedtuple("ThreadInfo", ["thread", "iid"])
|
|
47
|
+
|
|
48
|
+
|
|
46
49
|
COLLAPSED_STACK_FORMATTER = AustinEventCollapsedStackFormatter()
|
|
47
50
|
|
|
48
51
|
|
|
@@ -136,12 +139,12 @@ class FrameStats(HierarchicalStats):
|
|
|
136
139
|
class ThreadStats(HierarchicalStats):
|
|
137
140
|
"""Thread statistics."""
|
|
138
141
|
|
|
139
|
-
label:
|
|
142
|
+
label: ThreadInfo
|
|
140
143
|
children: Dict[AustinFrame, FrameStats] = field(default_factory=dict) # type: ignore[assignment]
|
|
141
144
|
|
|
142
145
|
def collapse(
|
|
143
146
|
self, stats_type: AustinStatsType
|
|
144
|
-
) -> Generator[Tuple[
|
|
147
|
+
) -> Generator[Tuple[ThreadInfo, List[AustinFrame], AustinMetrics], None, None]:
|
|
145
148
|
"""Collapse the hierarchical statistics."""
|
|
146
149
|
|
|
147
150
|
if self.own:
|
|
@@ -166,7 +169,7 @@ class ProcessStats:
|
|
|
166
169
|
"""Process statistics."""
|
|
167
170
|
|
|
168
171
|
pid: ProcessId
|
|
169
|
-
threads: Dict[
|
|
172
|
+
threads: Dict[ThreadInfo, ThreadStats] = field(default_factory=dict)
|
|
170
173
|
|
|
171
174
|
def collapse(
|
|
172
175
|
self, stats_type: AustinStatsType
|
|
@@ -175,22 +178,22 @@ class ProcessStats:
|
|
|
175
178
|
yield from (
|
|
176
179
|
AustinSample(
|
|
177
180
|
pid=self.pid,
|
|
178
|
-
iid=
|
|
179
|
-
thread=
|
|
181
|
+
iid=thread_info.iid,
|
|
182
|
+
thread=thread_info.thread,
|
|
180
183
|
frames=tuple(frames),
|
|
181
184
|
metrics=metric,
|
|
182
185
|
)
|
|
183
186
|
for thread in self.threads.values()
|
|
184
|
-
for
|
|
187
|
+
for thread_info, frames, metric in thread.collapse(stats_type)
|
|
185
188
|
)
|
|
186
189
|
|
|
187
|
-
def get_thread(self,
|
|
190
|
+
def get_thread(self, thread_info: ThreadInfo) -> Optional[ThreadStats]:
|
|
188
191
|
"""Get thread statistics from this process by name.
|
|
189
192
|
|
|
190
193
|
If the given thread name is not registered with this current process
|
|
191
194
|
statistics, then ``None`` is returned.
|
|
192
195
|
"""
|
|
193
|
-
return self.threads.get(
|
|
196
|
+
return self.threads.get(thread_info)
|
|
194
197
|
|
|
195
198
|
|
|
196
199
|
@dataclass
|
|
@@ -286,8 +289,8 @@ class AustinStats:
|
|
|
286
289
|
return
|
|
287
290
|
|
|
288
291
|
pid = sample.pid
|
|
289
|
-
|
|
290
|
-
thread_stats = ThreadStats(
|
|
292
|
+
thread_info = ThreadInfo(sample.thread, sample.iid or 0)
|
|
293
|
+
thread_stats = ThreadStats(thread_info, own=0, total=metric)
|
|
291
294
|
|
|
292
295
|
# Convert the list of frames into a nested FrameStats instance
|
|
293
296
|
stats: HierarchicalStats = thread_stats
|
|
@@ -300,15 +303,15 @@ class AustinStats:
|
|
|
300
303
|
|
|
301
304
|
with self._lock:
|
|
302
305
|
if pid not in self.processes:
|
|
303
|
-
self.processes[pid] = ProcessStats(pid, {
|
|
306
|
+
self.processes[pid] = ProcessStats(pid, {thread_info: thread_stats})
|
|
304
307
|
return
|
|
305
308
|
|
|
306
309
|
process = self.processes[pid]
|
|
307
|
-
if
|
|
308
|
-
process.threads[
|
|
310
|
+
if thread_info not in process.threads:
|
|
311
|
+
process.threads[thread_info] = thread_stats
|
|
309
312
|
return
|
|
310
313
|
|
|
311
|
-
process.threads[
|
|
314
|
+
process.threads[thread_info] << thread_stats
|
|
312
315
|
|
|
313
316
|
def flatten(self) -> Generator[AustinSample, None, None]:
|
|
314
317
|
for process in self.processes.values():
|
|
@@ -127,10 +127,10 @@ source = ["austin"]
|
|
|
127
127
|
[tool.coverage.report]
|
|
128
128
|
show_missing = true
|
|
129
129
|
|
|
130
|
-
[tool.isort]
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
130
|
+
[tool.ruff.lint.isort]
|
|
131
|
+
force-single-line = true
|
|
132
|
+
lines-after-imports = 2
|
|
133
|
+
force-sort-within-sections = true
|
|
134
134
|
|
|
135
135
|
[tool.mypy]
|
|
136
136
|
ignore_missing_imports = true
|
|
@@ -21,19 +21,19 @@
|
|
|
21
21
|
# You should have received a copy of the GNU General Public License
|
|
22
22
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
23
23
|
|
|
24
|
-
import io
|
|
25
24
|
from copy import deepcopy
|
|
25
|
+
import io
|
|
26
26
|
|
|
27
27
|
from austin.events import AustinFrame
|
|
28
28
|
from austin.events import AustinMetrics
|
|
29
29
|
from austin.events import AustinSample
|
|
30
|
-
from austin.events import ThreadName
|
|
31
30
|
from austin.format.collapsed_stack import AustinFileReader
|
|
32
31
|
from austin.format.collapsed_stack import parse_collapsed_stack
|
|
33
32
|
from austin.stats import AustinStats
|
|
34
33
|
from austin.stats import AustinStatsType
|
|
35
34
|
from austin.stats import FrameStats
|
|
36
35
|
from austin.stats import ProcessStats
|
|
36
|
+
from austin.stats import ThreadInfo
|
|
37
37
|
from austin.stats import ThreadStats
|
|
38
38
|
|
|
39
39
|
|
|
@@ -54,8 +54,8 @@ def test_austin_stats_single_process():
|
|
|
54
54
|
42: ProcessStats(
|
|
55
55
|
pid=42,
|
|
56
56
|
threads={
|
|
57
|
-
|
|
58
|
-
label=
|
|
57
|
+
ThreadInfo("0x7f45645646", 0): ThreadStats(
|
|
58
|
+
label=ThreadInfo("0x7f45645646", 0),
|
|
59
59
|
own=0,
|
|
60
60
|
total=152,
|
|
61
61
|
children={
|
|
@@ -82,8 +82,8 @@ def test_austin_stats_single_process():
|
|
|
82
82
|
42: ProcessStats(
|
|
83
83
|
pid=42,
|
|
84
84
|
threads={
|
|
85
|
-
|
|
86
|
-
label=
|
|
85
|
+
ThreadInfo("0x7f45645646", 0): ThreadStats(
|
|
86
|
+
label=ThreadInfo("0x7f45645646", 0),
|
|
87
87
|
total=300,
|
|
88
88
|
own=148,
|
|
89
89
|
children={
|
|
@@ -110,8 +110,8 @@ def test_austin_stats_single_process():
|
|
|
110
110
|
42: ProcessStats(
|
|
111
111
|
pid=42,
|
|
112
112
|
threads={
|
|
113
|
-
|
|
114
|
-
label=
|
|
113
|
+
ThreadInfo("0x7f45645646", 0): ThreadStats(
|
|
114
|
+
label=ThreadInfo("0x7f45645646", 0),
|
|
115
115
|
total=400,
|
|
116
116
|
own=148,
|
|
117
117
|
children={
|
|
@@ -138,8 +138,8 @@ def test_austin_stats_single_process():
|
|
|
138
138
|
42: ProcessStats(
|
|
139
139
|
pid=42,
|
|
140
140
|
threads={
|
|
141
|
-
|
|
142
|
-
label=
|
|
141
|
+
ThreadInfo("0x7f45645646", 0): ThreadStats(
|
|
142
|
+
label=ThreadInfo("0x7f45645646", 0),
|
|
143
143
|
total=800,
|
|
144
144
|
own=148,
|
|
145
145
|
children={
|
|
@@ -175,8 +175,8 @@ def test_austin_stats_single_process():
|
|
|
175
175
|
42: ProcessStats(
|
|
176
176
|
pid=42,
|
|
177
177
|
threads={
|
|
178
|
-
|
|
179
|
-
label=
|
|
178
|
+
ThreadInfo("0x7f45645664", 0): ThreadStats(
|
|
179
|
+
label=ThreadInfo("0x7f45645664", 0),
|
|
180
180
|
own=0,
|
|
181
181
|
total=152,
|
|
182
182
|
children={
|
|
@@ -191,8 +191,8 @@ def test_austin_stats_single_process():
|
|
|
191
191
|
)
|
|
192
192
|
},
|
|
193
193
|
),
|
|
194
|
-
|
|
195
|
-
label=
|
|
194
|
+
ThreadInfo("0x7f45645646", 0): ThreadStats(
|
|
195
|
+
label=ThreadInfo("0x7f45645646", 0),
|
|
196
196
|
total=800,
|
|
197
197
|
own=148,
|
|
198
198
|
children={
|
|
@@ -302,8 +302,8 @@ def test_load():
|
|
|
302
302
|
42: ProcessStats(
|
|
303
303
|
pid=42,
|
|
304
304
|
threads={
|
|
305
|
-
|
|
306
|
-
label=
|
|
305
|
+
ThreadInfo("0x7f45645646", 0): ThreadStats(
|
|
306
|
+
label=ThreadInfo("0x7f45645646", 0),
|
|
307
307
|
own=0,
|
|
308
308
|
total=1300,
|
|
309
309
|
children={
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|