-
Notifications
You must be signed in to change notification settings - Fork 52
Pystats docs #650
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Pystats docs #650
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good start!
pystats_docs.md
Outdated
|
||
## Specialization stats | ||
|
||
TBD |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we ask @markshannon tp help fill these TBD entries?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For each family, there are three tables:
Kind
Lists the number of "deferred" (i.e. not specialized) instructions executed, the number of "hits" (specialized instructions that complete) and "misses" (specialized instructions that deopt).
Unnamed
Success: Number of specialization attempts that were successful
Failure: Number of specialization attempts that failed for some reason
Failure kind
Numbers for the various kinds of specialization failures.
The total should add up to the "Failure" entry in the above table.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@markshannon: For the Kind table, I see "specialization.deferred", "specialization.deopt", "hit" and "miss". What is the difference between "deopt" and "miss"?
EDIT: Nevermind -- I was looking at some old results.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mdboom Can you add this to the doc?
It occurs to me that what we really ought to do is put this information in the generated output from |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A few more…
Co-authored-by: Guido van Rossum <[email protected]>
Co-authored-by: Guido van Rossum <[email protected]>
Co-authored-by: Guido van Rossum <[email protected]>
Blocked on @markshannon answering some inline questions. |
|
||
TBD | ||
|
||
## Specialization effectiveness |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Specialization effectiveness
All entries are execution counts. Should add up to the total number of T1 instructions executed.
Basic: Instructions that are not and cannot be specialized, e.g. LOAD_FAST
.
Not specialized: Instructions could be specialized but aren't. E.g. LOAD_ATTR
, BINARY_SLICE
Specialized hits: Specialized instructions, e.g. LOAD_ATTR_MODULE
that complete
Specialized misses: Specialized instructions, e.g. LOAD_ATTR_MODULE
that deopt
I think there is a bug in the "Not specialized" numbers. We are counting POP_JUMP_IF_...
but we shouldn't be.
Deferred by instruction
Breakdown of deferred (not specialized) instruction counts by family.
Misses by instruction
Breakdown of misses (specialized deopts) instruction counts by family.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I filed a CPython issue for the not specialized numbers problem: python/cpython#115521
pystats_docs.md
Outdated
|
||
## Call stats | ||
|
||
TBD |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is shows what fraction of calls to Python functions are inlined (no call at the C level) and for those that are not, where the call comes from. The various categories overlap.
Also includes count of frame objects created.
Read the code for more details.
pystats_docs.md
Outdated
|
||
## Object stats | ||
|
||
TBD |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Grab bag of stats about objects:
"Allocations" means "allocations that are not from a freelist". Total allocations = "Allocations from freelist" + "Allocations"
"New values" is the number of values array created for objects with managed dicts.
The cache hit/miss numbers are for the MRO cache, split into dunder and other names.
pystats_docs.md
Outdated
|
||
## GC stats | ||
|
||
TBD |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
By generation. Collected/visits gives some measure of efficiency
I've incorporated @markshannon's content and will go ahead and merge (this is just a local reference -- we can always iterate). |
|
||
This is the count of how many times each Tier 1 instruction is executed. | ||
|
||
The "miss ratio" column shows the percentage of times when instruction executed that it deoptimized. In this case the base unspecialized instruction is not counted. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe add "The deoptimization event is counted separately, see below".
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry I merged too quickly. Added here: #655
Based on this comment: #650 (comment)
Based on this comment: #650 (comment)
This is a first pass at trying to document the fields in the pystats. The most important ones (and the ones I'm most familiar with) are the Tier 2-related ones, so I've started with those and we can come back to the other ones later.
This probably belongs in CPython proper, but we can iterate here and submit there later.