Skip to content

Instantly share code, notes, and snippets.

@bogdad
Created April 15, 2023 13:21
Show Gist options
  • Save bogdad/ae3bbe5ce3945a27cb71bca92e3cca54 to your computer and use it in GitHub Desktop.
Save bogdad/ae3bbe5ce3945a27cb71bca92e3cca54 to your computer and use it in GitHub Desktop.
plot.py
import matplotlib.pyplot as plt
import csv
def pl(threads_list, token_time_list, nn):
if nn:
plt.plot(threads_list, token_time_list)
else:
plt.plot(threads_list, token_time_list, '--', color='orange')
def plf(f, nn):
threads_list = []
token_time_list = []
reader = csv.reader(f)
for row in reader:
threads_list.append(int(row[0]))
token_time_list.append(float(row[1]))
pl(threads_list, token_time_list, nn)
plt.xlabel("Number of threads")
plt.ylabel("Token time (ms)")
plt.title("Token time vs Number of threads")
with open('master.csv', newline='') as f:
plf(f, True)
with open('threadpool.csv', newline='') as f:
plf(f, False)
plt.show()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment