Solution Exercise A #1
1 changed files with 6 additions and 1 deletions
|
@ -7,7 +7,10 @@ threads, timings = [], []
|
||||||
for file in os.listdir('timings'):
|
for file in os.listdir('timings'):
|
||||||
with open(f'timings/{file}', 'r') as f:
|
with open(f'timings/{file}', 'r') as f:
|
||||||
n, t = f.read().strip().split(',')
|
n, t = f.read().strip().split(',')
|
||||||
|
if n != "None":
|
||||||
threads.append(int(n))
|
threads.append(int(n))
|
||||||
|
else:
|
||||||
|
threads.append(0)
|
||||||
timings.append(float(t))
|
timings.append(float(t))
|
||||||
threads = np.array(threads)
|
threads = np.array(threads)
|
||||||
timings = np.array(timings)
|
timings = np.array(timings)
|
||||||
|
@ -19,5 +22,7 @@ fig, axs = plt.subplots()
|
||||||
# CREATE YOUR PLOT HERE
|
# CREATE YOUR PLOT HERE
|
||||||
# Remember to label your axis
|
# Remember to label your axis
|
||||||
# Feel free to make it pretty
|
# Feel free to make it pretty
|
||||||
|
axs.scatter(threads, timings)
|
||||||
|
axs.set(xlabel="Threads", ylabel="Time (s)", xlim=(-1, max(threads)*1.1), ylim=(0, max(timings)*1.1), title="Time vs Threads")
|
||||||
|
|
||||||
plt.savefig('threads_v_timings.png', dpi=300)
|
plt.savefig('threads_v_timings.png', dpi=300)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue