Created
April 15, 2023 13:21
-
-
Save bogdad/ae3bbe5ce3945a27cb71bca92e3cca54 to your computer and use it in GitHub Desktop.
plot.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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