plot sbc buffer, expects file sbc-buffer.csv

This commit is contained in:
Milanka Ringwald 2017-05-31 12:44:58 +02:00
parent 13e71c7bf4
commit eacb07ef8f

29
test/avdtp/plot_sbc_buffer.py Executable file
View File

@ -0,0 +1,29 @@
#!/usr/bin/env python
import matplotlib.pyplot as plt
import csv
timestamp = list()
storage = list()
sbc_buffer_name = 'sbc_buffer.pdf'
with open('sbc-buffer.csv', 'rb') as csvfile:
data = csv.reader(csvfile, delimiter=' ')
for row in data:
i = 0
for cell in row:
if i == 0:
timestamp.append(int(cell))
i = 1
elif i == 1:
storage.append(int(cell))
i = 2
t = len(timestamp)
plt.plot(timestamp[0:t], storage[0:t], '.')
plt.xlabel('Time [ms]')
plt.ylabel('Queued SBC frames')
#plt.show()
plt.savefig(sbc_buffer_name)
print("\nCreated figure \'%s\', audio duration %d seconds.\n" % (sbc_buffer_name, len(timestamp)/1000))