()
| 1189 | |
| 1190 | |
| 1191 | def optimization_section() -> Section: |
| 1192 | def calc_optimization_table(stats: Stats) -> Rows: |
| 1193 | optimization_stats = stats.get_optimization_stats() |
| 1194 | |
| 1195 | return [ |
| 1196 | ( |
| 1197 | label, |
| 1198 | Count(value), |
| 1199 | Ratio(value, den, percentage=label != "Uops executed"), |
| 1200 | ) |
| 1201 | for label, (value, den) in optimization_stats.items() |
| 1202 | ] |
| 1203 | |
| 1204 | def calc_optimizer_table(stats: Stats) -> Rows: |
| 1205 | optimizer_stats = stats.get_optimizer_stats() |
| 1206 | |
| 1207 | return [ |
| 1208 | (label, Count(value), Ratio(value, den)) |
| 1209 | for label, (value, den) in optimizer_stats.items() |
| 1210 | ] |
| 1211 | |
| 1212 | def calc_jit_memory_table(stats: Stats) -> Rows: |
| 1213 | jit_memory_stats = stats.get_jit_memory_stats() |
| 1214 | |
| 1215 | return [ |
| 1216 | ( |
| 1217 | label, |
| 1218 | Count(value), |
| 1219 | Ratio(value, den, percentage=label != "Total memory size"), |
| 1220 | ) |
| 1221 | for label, (value, den) in jit_memory_stats.items() |
| 1222 | ] |
| 1223 | |
| 1224 | def calc_histogram_table(key: str, den: str | None = None) -> RowCalculator: |
| 1225 | def calc(stats: Stats) -> Rows: |
| 1226 | histogram = stats.get_histogram(key) |
| 1227 | |
| 1228 | if den: |
| 1229 | denominator = stats.get(den) |
| 1230 | else: |
| 1231 | denominator = 0 |
| 1232 | for _, v in histogram: |
| 1233 | denominator += v |
| 1234 | |
| 1235 | rows: Rows = [] |
| 1236 | for k, v in histogram: |
| 1237 | rows.append( |
| 1238 | ( |
| 1239 | f"<= {k:,d}", |
| 1240 | Count(v), |
| 1241 | Ratio(v, denominator), |
| 1242 | ) |
| 1243 | ) |
| 1244 | # Don't include any leading and trailing zero entries |
| 1245 | start = 0 |
| 1246 | end = len(rows) - 1 |
| 1247 | |
| 1248 | while start <= end: |
no test coverage detected
searching dependent graphs…