summaryrefslogtreecommitdiffstats
path: root/plot_fig4.py
blob: 8d5fe1530ea1b27b8be209b9ff77279bf8a0c3a3 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#!/usr/bin/env python3
# Copied from jupyter notebook at 1:43 AM on Sept 13 2022
import numpy
import matplotlib
# Headless backend. Comment this out if you want to use X.
matplotlib.use("Agg")
import matplotlib.pyplot as plt
import sys

if len(sys.argv) < 2:
	print("Usage: {} <output from paging_speed>".format(sys.argv[0]))
	exit(1)

# Load data
#paging_times = numpy.loadtxt(sys.argv[1], delimiter=",", skiprows=1)
paging_times = numpy.genfromtxt(sys.argv[1], skip_header=1, delimiter=',', dtype=None, usecols=[0,1])

# Convert to milliseconds
paging_times = numpy.divide(paging_times, 1000)

# Plot
plt.ylabel("Milliseconds")
plt.xlabel("I/O Method")
plt.boxplot(numpy.transpose(paging_times), labels=["Demand Paging", "Direct I/O"])
plt.ylim(bottom=0, top=1000)
plt.tight_layout()
plt.savefig("fig4.pdf")
print("Plot saved as fig4.pdf.")