Skip to content

Commit 4925c33

Browse files
committed
Truncate histograms
1 parent c897328 commit 4925c33

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

Tools/scripts/summarize_stats.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -822,14 +822,19 @@ def __init__(self, key: str, den: str):
822822

823823
def calculate_rows(self, stats: Stats) -> Rows:
824824
rows: Rows = []
825+
last_non_zero = 0
825826
for k, v in stats.items():
826827
if k.startswith(self.key):
827828
match = re.match(r".+\[([0-9]+)\]", k)
828829
if match is not None:
829830
entry = int(match.groups()[0])
831+
if v != 0:
832+
last_non_zero = len(rows)
830833
rows.append(
831834
(f"<= {entry}", Count(v), Ratio(int(v), stats[self.den]))
832835
)
836+
# Don't include any zero entries at the end
837+
rows = rows[:last_non_zero + 1]
833838
return rows
834839

835840
class UnsupportedOpcodesTable(SimpleChangeTable):

0 commit comments

Comments
 (0)