Skip to content

Commit

Permalink
seal5/backends/report/times/writer.py: add --sum-level arg
Browse files Browse the repository at this point in the history
  • Loading branch information
PhilippvK committed Nov 5, 2024
1 parent 05a713e commit 03b172b
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 6 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/demo.yml
Original file line number Diff line number Diff line change
Expand Up @@ -173,9 +173,9 @@ jobs:
echo >> $GITHUB_STEP_SUMMARY
# Stage Times
python3 -m seal5.backends.report.times.writer --yaml /tmp/seal5_llvm/.seal5/settings.yml --pass-times --output reports/stage_times.csv
python3 -m seal5.backends.report.times.writer --yaml /tmp/seal5_llvm/.seal5/settings.yml --pass-times --output reports/stage_times.md
python3 -m seal5.backends.report.times.writer --yaml /tmp/seal5_llvm/.seal5/settings.yml --pass-times --output reports/stage_times.mermaid
python3 -m seal5.backends.report.times.writer --yaml /tmp/seal5_llvm/.seal5/settings.yml --pass-times --output reports/stage_times.csv --sum-level 2
python3 -m seal5.backends.report.times.writer --yaml /tmp/seal5_llvm/.seal5/settings.yml --pass-times --output reports/stage_times.md --sum-level 2
python3 -m seal5.backends.report.times.writer --yaml /tmp/seal5_llvm/.seal5/settings.yml --pass-times --output reports/stage_times.mermaid --aum-level 2
echo "### Stage/Pass Times" >> $GITHUB_STEP_SUMMARY
echo >> $GITHUB_STEP_SUMMARY
cat reports/stage_times.md >> $GITHUB_STEP_SUMMARY
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/demo_weekly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -166,9 +166,9 @@ jobs:
echo >> $GITHUB_STEP_SUMMARY
# Stage Times
python3 -m seal5.backends.report.times.writer --yaml /tmp/seal5_llvm/.seal5/settings.yml --pass-times --output reports/stage_times.csv
python3 -m seal5.backends.report.times.writer --yaml /tmp/seal5_llvm/.seal5/settings.yml --pass-times --output reports/stage_times.md
python3 -m seal5.backends.report.times.writer --yaml /tmp/seal5_llvm/.seal5/settings.yml --pass-times --output reports/stage_times.mermaid
python3 -m seal5.backends.report.times.writer --yaml /tmp/seal5_llvm/.seal5/settings.yml --pass-times --output reports/stage_times.csv --sum-level 2
python3 -m seal5.backends.report.times.writer --yaml /tmp/seal5_llvm/.seal5/settings.yml --pass-times --output reports/stage_times.md --sum-levrl 2
python3 -m seal5.backends.report.times.writer --yaml /tmp/seal5_llvm/.seal5/settings.yml --pass-times --output reports/stage_times.mermaid --sum-level 2
echo "### Stage/Pass Times" >> $GITHUB_STEP_SUMMARY
echo >> $GITHUB_STEP_SUMMARY
cat reports/stage_times.md >> $GITHUB_STEP_SUMMARY
Expand Down
5 changes: 5 additions & 0 deletions seal5/backends/report/times/writer.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ def main():
parser.add_argument("--fmt", type=str, choices=["auto", "csv", "pkl", "md", "mermaid"], default="auto")
parser.add_argument("--yaml", type=str, default=None)
parser.add_argument("--pass-times", action="store_true")
parser.add_argument("--sum-level", type=int, default=None)
args = parser.parse_args()

# initialize logging
Expand Down Expand Up @@ -109,6 +110,10 @@ def traverse(x, prefix=None):

if args.pass_times:
pass_times_df = pd.DataFrame(pass_times)
if args.sum_level:
pass_times_df["pass"] = pass_times_df["pass"].apply(lambda x: ".".join(x.split(".")[:args.sum_level]))
pass_times_df = pass_times_df.groupby("pass", as_index=False).agg({"start": "min", "end": "max"})
pass_times_df["time_s"] = pass_times_df["end"] - pass_times_df["start"]
times_df = pd.concat([stage_times_df, pass_times_df])
else:
times_df = stage_times_df
Expand Down

0 comments on commit 03b172b

Please sign in to comment.