Skip to content

Add option to write specialization stats to files and script to summarize. #27575

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

Merged
merged 4 commits into from
Aug 4, 2021

Conversation

markshannon
Copy link
Member

Enables us to gather specialization stats without having to modify the Python being run code in any way.
E.g.
Setting the compile-time flags to 1, and running ./python pystone.py, then running
$ python3 Tools/scripts/summarize_specialization_stats.py
prints the following:

binary_subscr:
    deferred:      100446 20.1%
       deopt:           0 0.0%
         hit:      400154 79.9%
        miss:           0 0.0%
 unquickened:         190 0.0%
  specialization_failure:        1579
  specialization_success:          20
load_attr:
    deferred:         566 0.1%
       deopt:          13 0.0%
         hit:      651131 99.8%
        miss:         104 0.0%
 unquickened:         909 0.1%
  specialization_failure:          23
  specialization_success:         106
load_global:
    deferred:         152 0.0%
       deopt:          23 0.0%
         hit:     2401708 92.2%
        miss:         207 0.0%
 unquickened:      202455 7.8%
  specialization_failure:           0
  specialization_success:         200

@iritkatriel
Copy link
Member

I think the summarize_specialization_stats.py script is missing.


TOTAL = "deferred", "hit", "miss", "unquickened"

def print_stats(name, stats):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
def print_stats(name, stats):
def print_stats(name, family_stats):

(There are two different things called stats in this script).

#else
fprintf(out, "Specialization stats:\n");
#endif
print_stats(out, &_specialization_stats[CALL_FUNCTION], "call_function");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CALL_FUNCTION hasn't been implemented yet 😉 .

@markshannon markshannon merged commit c83919b into python:main Aug 4, 2021
@markshannon markshannon deleted the write-stats-to-files branch August 4, 2021 10:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants