(key: str, den: str | None = None)
| 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: |
| 1249 | if rows[start][1] == 0: |
| 1250 | start += 1 |
| 1251 | elif rows[end][1] == 0: |
| 1252 | end -= 1 |
| 1253 | else: |
| 1254 | break |
| 1255 | |
| 1256 | return rows[start:end+1] |
| 1257 | |
| 1258 | return calc |
| 1259 | |
| 1260 | def calc_unsupported_opcodes_table(stats: Stats) -> Rows: |
| 1261 | unsupported_opcodes = stats.get_opcode_stats("unsupported_opcode") |
no outgoing calls
no test coverage detected
searching dependent graphs…