Small Fixes

This commit is contained in:
Felipe Salerno Prado
2016-05-24 11:40:57 +02:00
parent eba49e6594
commit 1688674eca

View File

@@ -40,29 +40,24 @@ def memory_utilisation_window(connection, tracePath):
bandwidthPercentage[0] = 0
bandwidth[0] = 0
for i in range(steps):
# print(i)
bandwidthPercentage[i] = 0
bandwidthPercentage[i+1] = 0
cursor.execute(queryPart, (i*windowSize, (i+1)*windowSize))
result = cursor.fetchone()
if(result is None):
cursor.execute(queryFull, (i*windowSize, (i+1)*windowSize))
result = cursor.fetchone()
if(result[0] is not None):
bandwidthPercentage[i] += int(result[0])
# print(bandwidthPercentage[i])
bandwidthPercentage[i+1] += int(result[0])
cursor.execute(queryEnd, (i*windowSize, i*windowSize, i*windowSize, (i+1)*windowSize))
result = cursor.fetchone()
if(result[0] is not None):
bandwidthPercentage[i] += int(result[0])
# print(bandwidthPercentage[i])
bandwidthPercentage[i+1] += int(result[0])
cursor.execute(queryBegin, ((i+1)*windowSize, i*windowSize, (i+1)*windowSize, (i+1)*windowSize))
result = cursor.fetchone()
if(result[0] is not None):
bandwidthPercentage[i] += int(result[0])
# print(bandwidthPercentage[i])
bandwidthPercentage[i+1] += int(result[0])
else:
bandwidthPercentage[i] = windowSize
# print(bandwidthPercentage[i])
bandwidthPercentage[i+1] = windowSize
bandwidthPercentage[i+1] = float(bandwidthPercentage[i+1]/windowSize)
bandwidth[i+1] = float(bandwidthPercentage[i+1])*float(maxDataRate)/1024
bandwidthPercentage[i+1] *= 100
@@ -79,14 +74,14 @@ def memory_utilisation_window(connection, tracePath):
import numpy as np
from matplotlib.backends.backend_pdf import PdfPages
time = np.arange(0, steps*windowSize, windowSize)
time = np.arange(0, (steps+1)*windowSize, windowSize)
plt.figure()
subplotIndex = 211
plt.subplot(subplotIndex)
plt.plot(time/1000, bandwidthPercentage)
#plt.xlabel('Time (ns)')
plt.xlabel('Time (ns)')
plt.ylabel('Bandwidth (%)')
plt.ylim(0, maximumPercentage + (10 - maximumPercentage%10))
plt.grid(True)