Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 7 additions & 4 deletions Tools/scripts/summarize_stats.py
Original file line number Diff line number Diff line change
Expand Up @@ -460,8 +460,11 @@ class JoinMode(enum.Enum):
# second column of each input table as a new column
CHANGE = 1
# Join using the first column as a key, indicating the change in the second
# column of each input table as a ne column, and omit all other columns
# column of each input table as a new column, and omit all other columns
CHANGE_ONE_COLUMN = 2
# Join using the first column as a key, and indicate the change as a new
# column, but don't sort by the amount of change.
CHANGE_NO_SORT = 3


class Table:
Expand All @@ -484,7 +487,7 @@ def join_row(self, key: str, row_a: tuple, row_b: tuple) -> tuple:
match self.join_mode:
case JoinMode.SIMPLE:
return (key, *row_a, *row_b)
case JoinMode.CHANGE:
case JoinMode.CHANGE | JoinMode.CHANGE_NO_SORT:
return (key, *row_a, *row_b, DiffRatio(row_a[0], row_b[0]))
case JoinMode.CHANGE_ONE_COLUMN:
return (key, row_a[0], row_b[0], DiffRatio(row_a[0], row_b[0]))
Expand All @@ -497,7 +500,7 @@ def join_columns(self, columns: Columns) -> Columns:
*("Base " + x for x in columns[1:]),
*("Head " + x for x in columns[1:]),
)
case JoinMode.CHANGE:
case JoinMode.CHANGE | JoinMode.CHANGE_NO_SORT:
return (
columns[0],
*("Base " + x for x in columns[1:]),
Expand Down Expand Up @@ -1027,7 +1030,7 @@ def iter_optimization_tables(base_stats: Stats, head_stats: Stats | None = None)
Table(
("Range", "Count:", "Ratio:"),
calc_histogram_table(name, den),
JoinMode.CHANGE,
JoinMode.CHANGE_NO_SORT,
)
],
)
Expand Down