Skip to content

Commit

Permalink
bytes written stats
Browse files Browse the repository at this point in the history
  • Loading branch information
k3it committed Feb 25, 2016
1 parent 68e614d commit 4c6cdd6
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion qsorder.py
Original file line number Diff line number Diff line change
Expand Up @@ -290,6 +290,9 @@ def writer():
utchr = now.hour
utcmin = now.minute
(lame, filename) = start_new_lame_stream()
start = time.clock() * 1000
bytes_written = 0
avg_rate = 0
while True:
#open a new file on top of the hour
now = datetime.datetime.utcnow()
Expand All @@ -302,8 +305,16 @@ def writer():
if (len(replay_frames) > 0):
data = replay_frames.popleft()
lame.stdin.write(data)
bytes_written += sys.getsizeof(data)
else:
time.sleep(1)
end = time.clock()*1000
if (end - start > 60000):
elapsed = end - start
sampling_rate = bytes_written/4/elapsed
print bytes_written, "bytes in ", elapsed, "ms. Sampling rate:", sampling_rate, "kHz"
start = end
bytes_written=0
time.sleep(1)
if (utcmin != now.minute and now.minute % 10 == 0 and now.minute != 0):
print "CTL:", str(now.hour).zfill(2) + ":" + str(now.minute).zfill(2) + "Z ...recording:", filename
contest_dir = "AUDIO_" + str(now.year)
Expand Down

0 comments on commit 4c6cdd6

Please sign in to comment.