Skip to content

Commit

Permalink
Write csv if assert fails (#22)
Browse files Browse the repository at this point in the history
Write data in workflow log if bounds assert fails

Co-authored-by: mcjohn974 <[email protected]>
  • Loading branch information
2 people authored and shishkin-pavel committed Jul 31, 2023
1 parent 2979741 commit 24372d0
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions tools/bench.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,22 +112,26 @@ def run_bench():
new_df['Min'] = min_Tgas_used
new_df['Max'] = max_Tgas_used

# Save the new DataFrame to a CSV file
new_df.to_csv(f"tools/benchmark/csvs/{commit}.csv", index=False)

# extract mean and variance for bench with loop_limit = 3000
mean = new_df.iloc[-1, 5]
variance = new_df.iloc[-1, 6]

print(f"Mean = {mean}\nVariance = {variance}")

UPPER_BOUND_MEAN = 255
LOWER_BOUND_MEAN = 245
UPPER_BOUND_MEAN = 204.5
LOWER_BOUND_MEAN = 203.5

# I runned code three times and values was 109.6, 77.7, 49.3, so this bounds will be changed soon, I think
UPPER_BOUND_VARIANCE = 130
LOWER_BOUND_VARIANCE = 40
UPPER_BOUND_VARIANCE = 0.1
LOWER_BOUND_VARIANCE = 0

assert mean <= UPPER_BOUND_MEAN
assert mean >= LOWER_BOUND_MEAN

assert variance <= UPPER_BOUND_VARIANCE
assert variance >= LOWER_BOUND_VARIANCE

# Save the new DataFrame to a CSV file
new_df.to_csv(f"tools/benchmark/csvs/{commit}.csv", index=False)

0 comments on commit 24372d0

Please sign in to comment.