In [64]:
%matplotlib inline
import matplotlib as mpl
import matplotlib.pyplot as p
import numpy as np
#%pylab inline
In [65]:
mpl.rcParams.update({'font.size': 14})
golden = (1 + 5 ** 0.5) / 2
colors = ["blue", "#CC0000", "green", "orange"]
def _plot(xs, ys, num=0):
    c = colors[num]
    p.plot(xs, ys, 'o-', markersize=7, color=c)
In [86]:
# Data from fiologparser.py (wip-interval with modifications in PRs)
mark_dat = np.genfromtxt("out/clat-073-mark.log", delimiter=',', skip_header=True, dtype=float)

# Data from fiologparser.py (numpy):
ref_dat = np.genfromtxt("out/clat-073-ref.log", delimiter=',', skip_header=True, dtype=float)

# Data from fiologparser-hist.py:
hist_dat = np.genfromtxt("out/clat-073-hist.log", delimiter=',', skip_header=True, dtype=float)

# Extract columns:
et,ss,mn,avg,med,p90,p95,p99,mx = np.transpose(ref_dat)
hist_et,hist_ss,hist_mn,hist_avg,hist_med,hist_p90,hist_p95,hist_p99,hist_mx = np.transpose(hist_dat)
mark_et,mark_ss,mark_mn,mark_avg,mark_med,mark_p90,mark_p95,mark_p99,mark_mx = np.transpose(mark_dat)
In [91]:
p.figure(figsize=(8*golden, 8))
_plot(et, ss)
_plot(et, hist_ss, 1)
_plot(mark_et, mark_ss, 2)
p.legend(["fiologparser-stream-numpy", "fiologparser-hist", "fiologparser-wip-interval"])
# Number of samples fairly accurate (overestimated for some reason).
# wip-interval version of fiologparser is missing intervals at the end (green line),
# but is otherwise identical to streaming numpy version:
Out[91]:
<matplotlib.legend.Legend at 0x7f3ba8187cf8>
In [95]:
figure(figsize=(8*golden, 8))
_plot(et, p90)
_plot(et, hist_p90, 1)
_plot(mark_et, mark_p90, 2)
ylim(0,155000)
legend(["fiologparser-stream-numpy", "fiologparser-hist", "fiologparser-wip-interval"])
# Histogramming very accurate compared to individual samples,
# more closely matches streaming numpy vresion of fiologparser
# presumably because the exact same weighted_percentile code is
# used to compute the percentiles. Not yet sure why wip-interval is
# consistenly higher than stream-numpy version:
Out[95]:
<matplotlib.legend.Legend at 0x7f3ba81c3320>
In [100]:
def plot_perc(et, ys1, ys2, m_et, m_ys, num, t):
    #subplot(2,3,num) # rows,columns,fignum
    figure(figsize=(8*golden, 8))
    _plot(et, ys1),
    _plot(et, ys2, 1)
    _plot(m_et, m_ys, 2)
    ylim(0,max(max(m_ys),max(ys1),max(ys2))*1.05)
    legend(["fiologparser-stream-numpy", "fiologparser-hist", "fiologparser-wip-interval"])
    title(t)
    show()
plot_perc(et, med, hist_med, mark_et, mark_med, 1, "Median (50th percentile)")
plot_perc(et, p90, hist_p90, mark_et, mark_p90, 2, "90th percentile")
plot_perc(et, p95, hist_p95, mark_et, mark_p95, 3, "95th percentile")
plot_perc(et, p99, hist_p99, mark_et, mark_p99, 4, "99th percentile")

# As the percentile increases, wip-interval and stream-numpy versions converge.
# Clearly there is an inherent difference in how the two are calculating
# weighted percentiles:
In [106]:
plot_perc(et[2:], mn[2:], hist_mn[2:], mark_et[1:], mark_mn[1:], 4, "min")
plot_perc(et, mx, hist_mx, mark_et, mark_mx, 4, "max")

# Maximums and minimums appear identical:
In [ ]: