MCPcopy Index your code
hub / github.com/python/cpython / iter_specialization_tables

Function iter_specialization_tables

Tools/scripts/summarize_stats.py:940–977  ·  view source on GitHub ↗
(base_stats: Stats, head_stats: Stats | None = None)

Source from the content-addressed store, hash-verified

938 return calc
939
940 def iter_specialization_tables(base_stats: Stats, head_stats: Stats | None = None):
941 opcode_base_stats = base_stats.get_opcode_stats("opcode")
942 names = opcode_base_stats.get_opcode_names()
943 if head_stats is not None:
944 opcode_head_stats = head_stats.get_opcode_stats("opcode")
945 names &= opcode_head_stats.get_opcode_names() # type: ignore
946 else:
947 opcode_head_stats = None
948
949 for opcode in sorted(names):
950 if not opcode_base_stats.is_specializable(opcode):
951 continue
952 if opcode_base_stats.get_specialization_total(opcode) == 0 and (
953 opcode_head_stats is None
954 or opcode_head_stats.get_specialization_total(opcode) == 0
955 ):
956 continue
957 yield Section(
958 opcode,
959 f"specialization stats for {opcode} family",
960 [
961 Table(
962 ("Kind", "Count:", "Ratio:"),
963 calc_specialization_table(opcode),
964 JoinMode.CHANGE,
965 ),
966 Table(
967 ("Success", "Count:", "Ratio:"),
968 calc_specialization_success_failure_table(opcode),
969 JoinMode.CHANGE,
970 ),
971 Table(
972 ("Failure kind", "Count:", "Ratio:"),
973 calc_specialization_failure_kind_table(opcode),
974 JoinMode.CHANGE,
975 ),
976 ],
977 )
978
979 return Section(
980 "Specialization stats",

Callers

nothing calls this directly

Calls 9

get_opcode_statsMethod · 0.80
get_opcode_namesMethod · 0.80
is_specializableMethod · 0.80
SectionClass · 0.70
TableClass · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…