Repository navigation
Unify handling of stats in the CPython VM #90230
Copy link
Copy link
Closed
Labels
interpreter-core(Objects, Python, Grammar, and Parser dirs)(Objects, Python, Grammar, and Parser dirs)
Description
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
assignee = None
closed_at = None
created_at = <Date 2021-12-14.16:17:53.632>
labels = []
title = 'Unify handling of stats in the CPython VM'
updated_at = <Date 2022-02-16.16:50:02.905>
user = 'https://github.com/markshannon'bugs.python.org fields:
activity = <Date 2022-02-16.16:50:02.905>
actor = 'brandtbucher'
assignee = 'none'
closed = False
closed_date = None
closer = None
components = []
creation = <Date 2021-12-14.16:17:53.632>
creator = 'Mark.Shannon'
dependencies = []
files = []
hgrepos = []
issue_num = 46072
keywords = ['patch']
message_count = 14.0
messages = ['408543', '408613', '408618', '408702', '408704', '408708', '408787', '412002', '412271', '412350', '412750', '412769', '412901', '413341']
nosy_count = 3.0
nosy_names = ['christian.heimes', 'Mark.Shannon', 'brandtbucher']
pr_nums = ['30116', '30139', '30145', '30169', '30989', '31051', '31060', '31079', '31104', '31105', '31108', '31197', '31211', '31228', '31234', '31250', '31251', '31254', '31259', '31289', '31324']
priority = 'normal'
resolution = None
stage = 'patch review'
status = 'open'
superseder = None
type = None
url = 'https://bugs.python.org/issue46072'
versions = []Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
interpreter-core(Objects, Python, Grammar, and Parser dirs)(Objects, Python, Grammar, and Parser dirs)
Activity
markshannon commentedon Dec 14, 2021
By "stats" I mean the internal numbers gathered by the VM for performance and debugging. This has nothing to do with any statistics module.
Currently various parts of the VM gather stats: the GC, dicts, the bytecode interpreter, type lookup cache, etc.
These stats have various compile time flags to turn them on and off. They have differing ways to display the stats, and no unified way to gather stats across different runs.
For the specialization stats we dump stats, which we can parse to collate stats across runs.
We should:
markshannon commentedon Dec 15, 2021
New changeset 342b93f by Mark Shannon in branch 'main':
bpo-46072: Add --with-pystats configure option to simplify gathering of VM stats (GH-30116)
342b93f
tiran commentedon Dec 15, 2021
Could you please add the new option to Doc/using/configure.rst ?
markshannon commentedon Dec 16, 2021
New changeset 4506bbe by Mark Shannon in branch 'main':
bpo-46072: Document --enable-stats option. (GH-30139)
4506bbe
tiran commentedon Dec 16, 2021
I just noticed that you are using hard-coded paths with /tmp for the pystats directory. That's problematic and opens the possibility of a symlink race attack.
Could please add exclusive create to _Py_PrintSpecializationStats()? The will prevent symlink attacks. fopen() mode "x" is not generally available in all libcs. You have to combine open() and fdopen():
markshannon commentedon Dec 16, 2021
The --enable-stats option is for CPython development and shouldn't be turned on for a release version, so I'm not really concerned about people attacking their own machines.
markshannon commentedon Dec 17, 2021
New changeset efd6236 by Mark Shannon in branch 'main':
bpo-46072: Add top level stats struct (GH-30169)
efd6236
markshannon commentedon Jan 28, 2022
New changeset 90ab138 by Mark Shannon in branch 'main':
bpo-46072: Add simple stats for Python calls. (GH-30989)
90ab138
markshannon commentedon Feb 1, 2022
New changeset 48be46e by Mark Shannon in branch 'main':
bpo-46072: Add some object layout and allocation stats (GH-31051)
48be46e
markshannon commentedon Feb 2, 2022
New changeset 187930f by Mark Shannon in branch 'main':
bpo-46072: Add some frame stats. (GH-31060)
187930f
markshannon commentedon Feb 7, 2022
New changeset 062460e by Mark Shannon in branch 'main':
bpo-46072: Improve LOAD_METHOD stats (GH-31104)
062460e
markshannon commentedon Feb 7, 2022
New changeset 9c979d7 by Mark Shannon in branch 'main':
bpo-46072: Merge dxpairs into py_stats. (GH-31197)
9c979d7
markshannon commentedon Feb 9, 2022
New changeset f71a69a by Mark Shannon in branch 'main':
bpo-46072: Output stats as markdown with collapsible sections. (GH-31228)
f71a69a
brandtbucher commentedon Feb 16, 2022
New changeset 580cd9a by Brandt Bucher in branch 'main':
bpo-46072: Add detailed failure stats for BINARY_OP (GH-31289)
580cd9a
penguin-wwy commentedon Apr 29, 2022
Python API should be provided? This allows us to have more accurate statistical information about the status.
For example, in pyperformance
bm_hexiom:Then get stats dict:
This helps us to more precisely analyze the impact of optimization on benchmark.
GH-90230: Add stats to breakdown the origin of calls to `PyEval_EvalF…
GH-90230: Fix warnings and failures with --enable-pystats (GH-96622)
markshannon commentedon Aug 15, 2024
The stats seem to working well, so I'm closing this.