Power over time charts

This commit is contained in:
Felipe Salerno Prado
2016-03-18 17:06:49 +01:00
parent b82e869374
commit faababba16

View File

@@ -72,6 +72,8 @@ 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))
@@ -101,9 +103,45 @@ def memory_utilisation_window(connection, tracePath):
pdf = PdfPages(OUTPUT_FILE)
pdf.savefig()
pdf.close()
plt.close()
return
@plot
def power_window(connection, tracePath):
cursor = connection.cursor()
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]))
cursor.execute(""" SELECT * FROM Power """)
time = [0] * steps
power = [0] * steps
for i in range(steps):
result = cursor.fetchone()
time[i] = int(result[0])/1000
power[i] = float(result[1])
name = ntpath.basename(tracePath)
basename, extension = os.path.splitext(name)
OUTPUT_FILE = 'power_' + basename + '.pdf'
print("Output file is {0}".format(OUTPUT_FILE))
import matplotlib.pyplot as plt
from matplotlib.backends.backend_pdf import PdfPages
plt.plot(time, power)
plt.xlabel('Time (ns)')
plt.ylabel('Power (mW)')
plt.grid(True)
pdf = PdfPages(OUTPUT_FILE)
pdf.savefig()
pdf.close()
plt.close()
return
# @plot
# def latency_histogram(connection):
# # This function plots an histogram with access latencys