update latency benchmark graph
This commit is contained in:
parent
27e101260c
commit
4867096047
1 changed files with 3 additions and 7 deletions
|
|
@ -2,10 +2,6 @@ import argparse
|
||||||
import pandas as pd
|
import pandas as pd
|
||||||
import matplotlib.pyplot as plt
|
import matplotlib.pyplot as plt
|
||||||
|
|
||||||
def shorten_title(title, max_len=12):
|
|
||||||
"""Return a shortened title for plotting."""
|
|
||||||
return title if len(title) <= max_len else title[:max_len] + "..."
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
parser = argparse.ArgumentParser(description="Generate latency graph from CSV.")
|
parser = argparse.ArgumentParser(description="Generate latency graph from CSV.")
|
||||||
parser.add_argument("--input", required=True, help="Input CSV file")
|
parser.add_argument("--input", required=True, help="Input CSV file")
|
||||||
|
|
@ -22,7 +18,7 @@ def main():
|
||||||
|
|
||||||
latencies = df["Latency(s)"].values
|
latencies = df["Latency(s)"].values
|
||||||
titles = df["Title"].values
|
titles = df["Title"].values
|
||||||
short_titles = [shorten_title(t) for t in titles]
|
short_titles = [t.split('_')[0] for t in titles]
|
||||||
|
|
||||||
# Compute average
|
# Compute average
|
||||||
avg_latency = latencies.mean()
|
avg_latency = latencies.mean()
|
||||||
|
|
@ -46,10 +42,10 @@ def main():
|
||||||
for i, value in enumerate(latencies):
|
for i, value in enumerate(latencies):
|
||||||
plt.text(i, value, f"{value:.3f}", ha="center", va="bottom", fontsize=8)
|
plt.text(i, value, f"{value:.3f}", ha="center", va="bottom", fontsize=8)
|
||||||
|
|
||||||
plt.xticks(rotation=45, ha="right")
|
plt.xlabel("Image Cases")
|
||||||
plt.xlabel("Name")
|
|
||||||
plt.ylabel("Latency (seconds)")
|
plt.ylabel("Latency (seconds)")
|
||||||
plt.title(f"Latency Performance of {args.user}")
|
plt.title(f"Latency Performance of {args.user}")
|
||||||
|
plt.ylim(1, 300)
|
||||||
|
|
||||||
plt.tight_layout()
|
plt.tight_layout()
|
||||||
plt.savefig(args.output)
|
plt.savefig(args.output)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue