added some session logging. added more disk-io-thread stats logging and parse script

This commit is contained in:
Arvid Norberg
2008-12-30 08:20:25 +00:00
parent d75985b84c
commit 06da1f8e8a
4 changed files with 41 additions and 28 deletions

View File

@@ -11,7 +11,7 @@ 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', 'hash', 'move', 'release', 'idle', 'delete', 'check_fastresume', 'check_files', 'clear-cache', 'abort_thread', 'abort_torrent', 'save_resume_data', 'rename_file', 'flushing']
throughput_keys = ['write', 'read']
# logfile format:
@@ -35,29 +35,29 @@ throughput = {}
for k in keys: state_timer[k] = 0
for k in throughput_keys: throughput[k] = 0
for l in lines:
l = l[:-1].split(' ')
l = l.strip().split()
if len(l) < 2:
print l
continue
try:
new_time = long(l[0])
while new_time > i + quantization:
i += quantization
state_timer[state] += i - time
time = i
for k in keys: print >>out, state_timer[k],
print >>out
for k in throughput_keys: print >>out2, throughput[k] / 1000.,
print >>out2
for k in keys: state_timer[k] = 0
for k in throughput_keys: throughput[k] = 0
state_timer[state] += new_time - time
time = new_time
state = l[1]
if state in throughput_keys:
throughput[state] += long(l[2])
except:
print l
# try:
new_time = long(l[0])
while new_time > i + quantization:
i += quantization
state_timer[state] += i - time
time = i
for k in keys: print >>out, state_timer[k],
print >>out
for k in throughput_keys: print >>out2, throughput[k] / 1000.,
print >>out2
for k in keys: state_timer[k] = 0
for k in throughput_keys: throughput[k] = 0
state_timer[state] += new_time - time
time = new_time
state = l[1]
if state in throughput_keys:
throughput[state] += long(l[2])
# except:
# print l
out.close()
out2.close()