()
| 879 | |
| 880 | |
| 881 | def specialization_section() -> Section: |
| 882 | def calc_specialization_table(opcode: str) -> RowCalculator: |
| 883 | def calc(stats: Stats) -> Rows: |
| 884 | DOCS = { |
| 885 | "deferred": 'Lists the number of "deferred" (i.e. not specialized) instructions executed.', |
| 886 | "hit": "Specialized instructions that complete.", |
| 887 | "miss": "Specialized instructions that deopt.", |
| 888 | "deopt": "Specialized instructions that deopt.", |
| 889 | } |
| 890 | |
| 891 | opcode_stats = stats.get_opcode_stats("opcode") |
| 892 | total = opcode_stats.get_specialization_total(opcode) |
| 893 | specialization_counts = opcode_stats.get_specialization_counts(opcode) |
| 894 | |
| 895 | return [ |
| 896 | ( |
| 897 | Doc(label, DOCS[label]), |
| 898 | Count(count), |
| 899 | Ratio(count, total), |
| 900 | ) |
| 901 | for label, count in specialization_counts.items() |
| 902 | ] |
| 903 | |
| 904 | return calc |
| 905 | |
| 906 | def calc_specialization_success_failure_table(name: str) -> RowCalculator: |
| 907 | def calc(stats: Stats) -> Rows: |
| 908 | values = stats.get_opcode_stats( |
| 909 | "opcode" |
| 910 | ).get_specialization_success_failure(name) |
| 911 | total = sum(values.values()) |
| 912 | if total: |
| 913 | return [ |
| 914 | (label.capitalize(), Count(val), Ratio(val, total)) |
| 915 | for label, val in values.items() |
| 916 | ] |
| 917 | else: |
| 918 | return [] |
| 919 | |
| 920 | return calc |
| 921 | |
| 922 | def calc_specialization_failure_kind_table(name: str) -> RowCalculator: |
| 923 | def calc(stats: Stats) -> Rows: |
| 924 | opcode_stats = stats.get_opcode_stats("opcode") |
| 925 | failures = opcode_stats.get_specialization_failure_kinds(name) |
| 926 | total = opcode_stats.get_specialization_failure_total(name) |
| 927 | |
| 928 | return sorted( |
| 929 | [ |
| 930 | (label, Count(value), Ratio(value, total)) |
| 931 | for label, value in failures.items() |
| 932 | if value |
| 933 | ], |
| 934 | key=itemgetter(1), |
| 935 | reverse=True, |
| 936 | ) |
| 937 | |
| 938 | return calc |
no test coverage detected
searching dependent graphs…