scripts: Add benchmark scripts and distribution logs
This commit is contained in:
parent
0690b7aa49
commit
228750032d
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,24 @@
|
|||
#!/bin/python
|
||||
|
||||
import numpy as np
|
||||
|
||||
def trimvalues(values, cutoff):
|
||||
sv = sorted(values)
|
||||
n = round(len(values) * cutoff)
|
||||
|
||||
var = []
|
||||
for i in range(len(values) - n):
|
||||
var += [np.std(sv[i:n+i])]
|
||||
|
||||
i = var.index(min(var))
|
||||
return sv[i:n+i]
|
||||
#
|
||||
#A = [ 0, 10, 11, 10, 11, 20, 18, 9, 8, 10, 18,6,7,8,9,12]
|
||||
#tA = trimvalues(A, 0.7)
|
||||
#
|
||||
#
|
||||
#print(" mean stddev")
|
||||
#print("A: %.2f %.2f" % (np.mean(A), np.std(A)))
|
||||
#print("tA: %.2f %.2f" % (np.mean(tA), np.std(tA)))
|
||||
#
|
||||
#print(tA)
|
|
@ -0,0 +1,52 @@
|
|||
#!/usr/bin/python
|
||||
|
||||
import sys
|
||||
|
||||
|
||||
def parse_table(f):
|
||||
curr = 0
|
||||
x = []
|
||||
y = []
|
||||
|
||||
while (True):
|
||||
line = f.readline()
|
||||
|
||||
if line == '#####\n':
|
||||
if curr == 3:
|
||||
break
|
||||
else:
|
||||
curr += 1
|
||||
elif curr == 2:
|
||||
v = [int(i) for i in line.strip().split()]
|
||||
x += [v[0]]
|
||||
y += [v[1]]
|
||||
return x, y
|
||||
|
||||
import matplotlib.pyplot as plt
|
||||
import numpy as np
|
||||
|
||||
fig = plt.figure()
|
||||
|
||||
with open(sys.argv[1]) as f:
|
||||
for i in range(0, 3):
|
||||
x, y = parse_table(f)
|
||||
fit = np.polyfit(x, y, 1)
|
||||
fit_fn = np.poly1d(fit)
|
||||
|
||||
ax = fig.add_subplot(2, 2, i)
|
||||
ax.plot(x, y, 'b', x, fit_fn(x), 'r')
|
||||
ax.set_xlabel('bucket')
|
||||
ax.set_ylabel('entries')
|
||||
ax.axis('tight')
|
||||
ax.text(0.03, 0.97,
|
||||
'mean=%.2f\nstddev=%.2f' % (np.mean(y), np.std(y)),
|
||||
transform=ax.transAxes,
|
||||
verticalalignment='top',
|
||||
horizontalalignment='left'
|
||||
)
|
||||
ax.grid(True)
|
||||
|
||||
fig.suptitle('Hash distribution on buckets', weight='bold', size='large')
|
||||
fig.tight_layout()
|
||||
plt.subplots_adjust(top=0.9)
|
||||
plt.show()
|
Loading…
Reference in New Issue