Increased height of horizontal I/O graph

* Allows for 32 steps of accuracy
* Adjusted curve to max out around 750 Mb/s
This commit is contained in:
2Shirt 2018-09-20 15:57:53 -06:00
parent d46ae18045
commit ba06b7d635
Signed by: 2Shirt
GPG key ID: 152FAC923B0E132C
2 changed files with 35 additions and 15 deletions

View file

@ -43,8 +43,8 @@ IO_VARS = {
'Minimum Test Size': 10*1024**3, 'Minimum Test Size': 10*1024**3,
'Alt Test Size Factor': 0.01, 'Alt Test Size Factor': 0.01,
'Progress Refresh Rate': 5, 'Progress Refresh Rate': 5,
'Scale 16': [2**(0.6*x)+(16*x) for x in range(1,17)], 'Scale 16': [2**(0.56*x)+(16*x) for x in range(1,17)],
'Scale 32': [2**(0.6*x/2)+(16*x/2) for x in range(1,33)], 'Scale 32': [2**(0.56*x/2)+(16*x/2) for x in range(1,33)],
'Threshold Fail': 65*1024**2, 'Threshold Fail': 65*1024**2,
'Threshold Warn': 135*1024**2, 'Threshold Warn': 135*1024**2,
'Threshold Great': 750*1024**2, 'Threshold Great': 750*1024**2,
@ -95,7 +95,7 @@ TESTS = {
def connect_to_db(): def connect_to_db():
"""Connect to osTicket database via SSH tunnel.""" """Connect to osTicket database via SSH tunnel."""
cmd = [ cmd = [
'ssh', '-N', '-p', '2222', '-L3306:127.0.0.1:3306', 'ssh', '-N', '-p', SSH_PORT, '-L3306:127.0.0.1:3306',
'{user}@{host}'.format(user=SSH_USER, host=DB_HOST), '{user}@{host}'.format(user=SSH_USER, host=DB_HOST),
] ]
@ -128,10 +128,12 @@ def disconnect_from_db():
def generate_horizontal_graph(rates): def generate_horizontal_graph(rates):
"""Generate two-line horizontal graph from rates, returns str.""" """Generate two-line horizontal graph from rates, returns str."""
line_top = '' line_1 = ''
line_bottom = '' line_2 = ''
line_3 = ''
line_4 = ''
for r in rates: for r in rates:
step = get_graph_step(r, scale=16) step = get_graph_step(r, scale=32)
# Set color # Set color
r_color = COLORS['CLEAR'] r_color = COLORS['CLEAR']
@ -143,15 +145,32 @@ def generate_horizontal_graph(rates):
r_color = COLORS['GREEN'] r_color = COLORS['GREEN']
# Build graph # Build graph
if step < 8: full_block = '{}{}'.format(r_color, IO_VARS['Graph Horizontal'][-1])
line_top += ' ' if step >= 24:
line_bottom += '{}{}'.format(r_color, IO_VARS['Graph Horizontal'][step]) line_1 += '{}{}'.format(r_color, IO_VARS['Graph Horizontal'][step-24])
line_2 += full_block
line_3 += full_block
line_4 += full_block
elif step >= 16:
line_1 += ' '
line_2 += '{}{}'.format(r_color, IO_VARS['Graph Horizontal'][step-16])
line_3 += full_block
line_4 += full_block
elif step >= 8:
line_1 += ' '
line_2 += ' '
line_3 += '{}{}'.format(r_color, IO_VARS['Graph Horizontal'][step-8])
line_4 += full_block
else: else:
line_top += '{}{}'.format(r_color, IO_VARS['Graph Horizontal'][step-8]) line_1 += ' '
line_bottom += '{}{}'.format(r_color, IO_VARS['Graph Horizontal'][-1]) line_2 += ' '
line_top += COLORS['CLEAR'] line_3 += ' '
line_bottom += COLORS['CLEAR'] line_4 += '{}{}'.format(r_color, IO_VARS['Graph Horizontal'][step])
return '{}\n{}'.format(line_top, line_bottom) line_1 += COLORS['CLEAR']
line_2 += COLORS['CLEAR']
line_3 += COLORS['CLEAR']
line_4 += COLORS['CLEAR']
return '\n'.join([line_1, line_2, line_3, line_4])
def get_graph_step(rate, scale=16): def get_graph_step(rate, scale=16):
"""Get graph step based on rate and scale, returns int.""" """Get graph step based on rate and scale, returns int."""
@ -763,7 +782,7 @@ def run_iobenchmark(ticket_number):
h_graph_rates.append(sum(read_rates[pos:pos+width])/width) h_graph_rates.append(sum(read_rates[pos:pos+width])/width)
pos += width pos += width
report = generate_horizontal_graph(h_graph_rates) report = generate_horizontal_graph(h_graph_rates)
report += '\nRead speed: {:3.1f} MB/s (Min: {:3.1f}, Max: {:3.1f})'.format( report += '\nAverage read speed: {:3.1f} MB/s (Min: {:3.1f}, Max: {:3.1f})'.format(
sum(read_rates)/len(read_rates)/(1024**2), sum(read_rates)/len(read_rates)/(1024**2),
min(read_rates)/(1024**2), min(read_rates)/(1024**2),
max(read_rates)/(1024**2)) max(read_rates)/(1024**2))

View file

@ -16,6 +16,7 @@ DB_HOST='127.0.0.1'
DB_NAME='osticket' DB_NAME='osticket'
DB_USER='wizardkit' DB_USER='wizardkit'
DB_PASS='Abracadabra' DB_PASS='Abracadabra'
SSH_PORT='22'
SSH_USER='sql_tunnel' SSH_USER='sql_tunnel'
# Live Linux # Live Linux
MPRIME_LIMIT='7' # of minutes to run Prime95 during hw-diags MPRIME_LIMIT='7' # of minutes to run Prime95 during hw-diags