Skip to content

Commit 2427324

Browse files
committed
Update collect_results.py.
1 parent 28783c1 commit 2427324

File tree

1 file changed

+16
-8
lines changed

1 file changed

+16
-8
lines changed

runner/collect_results.py

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -57,14 +57,22 @@ def main():
5757

5858
def create_json(all_data: pd.DataFrame) -> str:
5959
group_by = ["benchmark", "target", "threads", "scheduler"]
60-
name_computer = lambda group: group[0] + " (" + ", ".join(
61-
f"{group_by[i]}={p}"
62-
for i, p in enumerate(group_by[1:])
63-
if len(all_data[p].unique()) > 1
64-
) + ")"
60+
def name_computer(group):
61+
parenthetical = [
62+
f"{p}={group[1 + i]}"
63+
for i, p in enumerate(group_by[1:])
64+
if p in all_data.columns and len(all_data[p].unique()) > 1
65+
]
66+
if len(parenthetical) == 0:
67+
return group[0]
68+
return group[0] + " (" + ", ".join(parenthetical) + ")"
6569
is_correct_group = lambda group: functools.reduce(
6670
lambda a, b: a & b,
67-
[all_data[group_by[i]].values == v for i, v in enumerate(group)]
71+
[
72+
(v == None and group_by[i] not in all_data.columns)
73+
or (v != None and all_data[group_by[i]].values == v)
74+
for i, v in enumerate(group)
75+
]
6876
)
6977
return [
7078
{
@@ -73,8 +81,8 @@ def create_json(all_data: pd.DataFrame) -> str:
7381
"value": all_data[is_correct_group(group)].mean_time_ms.mean(),
7482
"extra": f"Target: {group[0]}"
7583
f"\nTotal Iterations: {all_data[is_correct_group(group)].total_iterations.iloc[0]}"
76-
(f"\nThreads: {group[2]}" if group[2] is not None else "")
77-
(f"\nScheduler: {group[-1]}" if group[-1] is not None else "")
84+
+ (f"\nThreads: {group[2]}" if group[2] is not None else "")
85+
+ (f"\nScheduler: {group[-1]}" if group[-1] is not None else "")
7886
}
7987
for group in product(*[
8088
all_data[p].unique() if p in all_data.columns else [None]

0 commit comments

Comments
 (0)