changed from a constant window size to a constant step size

This commit is contained in:
Matthias Jung
2016-02-27 12:29:25 +01:00
parent 65579d2ea4
commit 3bee70945d

View File

@@ -20,11 +20,11 @@ def memory_utilisation_window(connection):
# Besides, extracting the data from the memory specs, it is possible to calculate the maximum data rate of the memory and then determine the bandwidth in Gbit/s.
# The bandwidth data are then plotted in two graphics.
windowSize = 1000000
steps = 1000
cursor = connection.cursor()
cursor.execute(""" SELECT max(DataStrobeEnd) FROM Transactions """)
total = cursor.fetchone()
steps = ceil(float(total[0])/float(windowSize))
windowSize = ceil(float(total[0])/float(steps))
# print(steps)
# All possible cases of data transfers inside a time window
queryFull = """ SELECT sum(DataStrobeEnd - DataStrobeBegin) FROM transactions Where DataStrobeBegin > ? and DataStrobeEnd < ?""" # The data transfer begins and ends inside the time window
@@ -38,7 +38,7 @@ def memory_utilisation_window(connection):
bandwidthPercentage = [0] * steps
bandwidth = [0] * steps
for i in range(steps):
# print(i)
#print(i)
bandwidthPercentage[i] = 0
cursor.execute(queryPart, (i*windowSize, (i+1)*windowSize))
result = cursor.fetchone()
@@ -90,18 +90,18 @@ def memory_utilisation_window(connection):
window.savefig()
window.close()
@plot
def latency_histogram(connection):
# This function plots an histogram with access latencys
cursor = connection.cursor()
cursor.execute("SELECT ((p2.PhaseEnd - p1.PhaseEnd)/1000) FROM Transactions t, Phases p1, Phases p2 WHERE t.id = p1.Transact and t.id = p2.Transact and p1.PhaseName = \"REQ\" and p2.PhaseName = \"RESP\" ")
result = cursor.fetchall()
#result.sort()
#print(max(result)[0])
import matplotlib.pyplot as plt
plt.hist(result, bins=max(result)[0], histtype='barstacked')
plt.savefig('hist.png')
return "Saved as hist.png"
#@plot
#def latency_histogram(connection):
# # This function plots an histogram with access latencys
# cursor = connection.cursor()
# cursor.execute("SELECT ((p2.PhaseEnd - p1.PhaseEnd)/1000) FROM Transactions t, Phases p1, Phases p2 WHERE t.id = p1.Transact and t.id = p2.Transact and p1.PhaseName = \"REQ\" and p2.PhaseName = \"RESP\" ")
# result = cursor.fetchall()
# #result.sort()
# #print(max(result)[0])
# import matplotlib.pyplot as plt
# plt.hist(result, bins=max(result)[0], histtype='barstacked')
# plt.savefig('hist.png')
# return "Saved as hist.png"
def generatePlots(pathToTrace):