Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
blocks-import-script: remove csv-output flag
Browse files Browse the repository at this point in the history
siddarthkay committed Jan 7, 2025
1 parent 3a3eb26 commit 6d5cf8e
Showing 1 changed file with 0 additions and 41 deletions.
41 changes: 0 additions & 41 deletions scripts/block-import-stats.py
Original file line number Diff line number Diff line change
@@ -2,7 +2,6 @@
import numpy as np
import matplotlib.pyplot as plt
import os
import csv
import argparse

plt.rcParams["figure.figsize"] = [40, 30]
@@ -85,42 +84,6 @@ def write_markdown_output(df_stats, df, baseline_name, contender_name):
print("\n(+) = more is better, (-) = less is better")


def write_csv_output(df_stats, df, csv_path):
"""Write statistics to a CSV file"""
total_blocks = df.block_number.max() - df.block_number.min()
time_xt = df.time_x.sum()
time_yt = df.time_y.sum()
timet = time_yt - time_xt

with open(csv_path, 'w', newline='') as csvfile:
csv_writer = csv.writer(csvfile)

csv_writer.writerow(['block_range', 'bps_x', 'bps_y', 'tps_x', 'tps_y',
'time_x', 'time_y', 'bpsd', 'tpsd', 'timed'])

for idx, row in df_stats.iterrows():
csv_writer.writerow([
str(idx), # block range
f"{row['bps_x']:.2f}",
f"{row['bps_y']:.2f}",
f"{row['tps_x']:.2f}",
f"{row['tps_y']:.2f}",
prettySecs(row['time_x']),
prettySecs(row['time_y']),
f"{row['bpsd']:.2%}",
f"{row['tpsd']:.2%}",
f"{row['timed']:.2%}"
])

csv_writer.writerow([])

csv_writer.writerow(['Total Blocks', total_blocks])
csv_writer.writerow(['Baseline Time', prettySecs(time_xt)])
csv_writer.writerow(['Contender Time', prettySecs(time_yt)])
csv_writer.writerow(['Time Difference', prettySecs(timet)])
csv_writer.writerow(['Time Difference %', f"{(timet/time_xt):.2%}"])


def write_standard_output(df_stats, df, baseline_name, contender_name):
print(f"{os.path.basename(baseline_name)} vs {os.path.basename(contender_name)}")
print(df_stats.to_string(
@@ -145,7 +108,6 @@ def main():
parser.add_argument("baseline")
parser.add_argument("contender")
parser.add_argument("--plot", action="store_true")
parser.add_argument("--csv-output", type=str, help="Path to output CSV file")
parser.add_argument("--markdown", action="store_true", help="Output in markdown table format")
parser.add_argument(
"--bins",
@@ -226,9 +188,6 @@ def main():
| dict.fromkeys(["bpsd", "tpsd", "timed"], "mean")
)

if args.csv_output:
write_csv_output(stats_df, df, args.csv_output)

if args.markdown:
write_markdown_output(stats_df, df, args.baseline, args.contender)

0 comments on commit 6d5cf8e

Please sign in to comment.