Charts Correction

This commit is contained in:
Felipe Salerno Prado
2016-04-28 17:22:40 +02:00
parent 98249947f4
commit c0f83bb1dc

View File

@@ -25,23 +25,19 @@ def memory_utilisation_window(connection, tracePath):
cursor.execute(""" SELECT max(time) FROM Power """)
maxTime = cursor.fetchone()
cursor.execute(""" SELECT min(time) FROM Power where time > 0 """)
windowSize = cursor.fetchone()
steps = ceil(float(maxTime[0])/float(windowSize[0]))
windowSize = cursor.fetchone()[0]
steps = ceil(float(maxTime[0])/float(windowSize))
# 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
queryEnd = """ SELECT sum(DataStrobeEnd - ?) FROM transactions Where DataStrobeBegin < ? and DataStrobeEnd > ? and DataStrobeEnd <=?""" # Only the end of the data transfer is inside the time window
queryBegin = """ SELECT sum(? - DataStrobeBegin) FROM transactions Where DataStrobeBegin >= ? and DataStrobeBegin < ? and DataStrobeEnd > ?""" # Only the beginning of the data transfer is inside the time window
queryPart = """ SELECT DataStrobeBegin FROM transactions Where DataStrobeBegin <= ? and DataStrobeEnd >= ?""" # The data transfer occupies all the time window
maxDataRate = maximum_data_rate(connection)
# print(width)
# print(clk)
# print(rate)
bandwidthPercentage = [0] * (steps+1)
bandwidth = [0] * (steps+1)
bandwidthPercentage[0] = 0
bandwidth[0] = 0
for i in range(steps):
# print(i)
bandwidthPercentage[i+1] = 0
cursor.execute(queryPart, (i*windowSize, (i+1)*windowSize))
result = cursor.fetchone()
@@ -71,8 +67,6 @@ def memory_utilisation_window(connection, tracePath):
name = ntpath.basename(tracePath)
basename, extension = os.path.splitext(name)
OUTPUT_FILE = 'memory_utilization_' + basename + '.pdf'
print("Output file is {0}".format(OUTPUT_FILE))
@@ -111,8 +105,8 @@ def power_window(connection, tracePath):
cursor.execute(""" SELECT max(time) FROM Power """)
maxTime = cursor.fetchone()
cursor.execute(""" SELECT min(time) FROM Power where time > 0 """)
windowSize = cursor.fetchone()
steps = ceil(float(maxTime[0])/float(windowSize[0]))
windowSize = cursor.fetchone()[0]
steps = ceil(float(maxTime[0])/float(windowSize))
cursor.execute(""" SELECT * FROM Power """)
time = [0] * (steps+1)
power = [0] * (steps+1)