improve disk stats logging to include cache hits

This commit is contained in:
Arvid Norberg
2010-01-31 21:13:52 +00:00
parent e154d56c1f
commit 238f7e38f5
6 changed files with 48 additions and 26 deletions

View File

@@ -11,12 +11,12 @@ if len(sys.argv) < 2:
print "usage: parse_disk_log.py logfile [seconds]"
sys.exit(1)
keys = ['write', 'read', 'hash', 'move', 'release', 'idle', \
keys = ['write', 'read', 'read-cache-hit', 'hash', 'move', 'release', 'idle', \
'delete', 'check_fastresume', 'check_files', 'clear-cache', \
'abort_thread', 'abort_torrent', 'save_resume_data', 'rename_file', \
'flushing', 'update_settings', 'finalize_file', 'sorting_job', \
'check_cache_hit']
throughput_keys = ['write', 'read']
throughput_keys = ['write', 'read', 'read-cache-hit']
# logfile format:
# <time(ms)> <state>
@@ -39,6 +39,7 @@ state_timer = {}
throughput = {}
for k in keys: state_timer[k] = 0
for k in throughput_keys: throughput[k] = 0
for l in lines:
l = l.strip().split()
if len(l) < 2:
@@ -58,7 +59,7 @@ for l in lines:
print >>out
print >>out2, time - start_time,
for k in throughput_keys:
print >>out2, throughput[k] / float(quantization),
print >>out2, throughput[k] * 1000 / float(quantization),
print '-- %s %d' % (k, throughput[k])
print >>out2
for k in keys: state_timer[k] = 0
@@ -78,7 +79,7 @@ for k in keys: print >>out, (state_timer[k] / float(quantization) * 100.),
print >>out
print >>out2, time - start_time,
for k in throughput_keys:
print >>out2, throughput[k] / float(quantization),
print >>out2, throughput[k] * 1000 / float(quantization),
print '-- %s %d' % (k, throughput[k])
print >>out2
for k in keys: state_timer[k] = 0
@@ -95,7 +96,7 @@ print >>out, 'set ylabel "throughput (kB/s)"'
print >>out, 'plot',
i = 0
for k in throughput_keys:
print >>out, ' "disk_throughput.dat" using 1:%d title "%s" with steps,' % (i + 2, throughput_keys[i]),
print >>out, ' "disk_throughput.dat" using 1:%d title "%s" with lines,' % (i + 2, throughput_keys[i]),
i = i + 1
print >>out, 'x=0'