Split BW plot in two seperated pictures
This commit is contained in:
@@ -15,12 +15,17 @@ def plot(function):
|
||||
|
||||
@plot
|
||||
def memory_utilisation_window(connection, tracePath, steps):
|
||||
# This function determines the average memory bandwidth over time in percentage and in Gbit/s.
|
||||
# The average bandwidth over time is done dividing the time into windows of the same length and getting the average bandwidth in each window.
|
||||
# Through data from the database, DataStrobeEnd and DataStrobeBegin, it is possible to assess when a data transfer begins or ends.
|
||||
# Hence, it is achievable to ckeck when a data transfer happens and if it occupies or is inside a time window. Then, it is attainable to determine the average bandwidth in percentage.
|
||||
# Besides, extracting the data from the memory specs, it is feasible 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.
|
||||
# This function determines the average memory bandwidth over time in
|
||||
# percentage and in Gbit/s. The average bandwidth over time is done
|
||||
# dividing the time into windows of the same length and getting the average
|
||||
# bandwidth in each window. Through data from the database, DataStrobeEnd
|
||||
# and DataStrobeBegin, it is possible to access when a data transfer begins
|
||||
# or ends. Hence, it is achievable to check when a data transfer happens
|
||||
# and if it occupies or is inside a time window. Then, it is attainable to
|
||||
# determine the average bandwidth in percentage. Besides, extracting the
|
||||
# data from the memory specs, it is feasible 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.
|
||||
|
||||
cursor = connection.cursor()
|
||||
cursor.execute(" SELECT WindowSize FROM GeneralInfo ")
|
||||
@@ -64,9 +69,9 @@ def memory_utilisation_window(connection, tracePath, steps):
|
||||
name = ntpath.basename(tracePath)
|
||||
basename, extension = os.path.splitext(name)
|
||||
|
||||
OUTPUT_FILE = 'memory_utilization_' + basename + '.pdf'
|
||||
outputFile = "Output file is {0}".format(OUTPUT_FILE)
|
||||
|
||||
outputFileNameGBPS = 'memory_utilization_gbps_' + basename + '.pdf'
|
||||
outputFileNamePercent = 'memory_utilization_percent_' + basename + '.pdf'
|
||||
outputFiles = "Output files are {0},{1}".format(outputFileNameGBPS,outputFileNamePercent)
|
||||
|
||||
import matplotlib.pyplot as plt
|
||||
import numpy as np
|
||||
@@ -74,31 +79,35 @@ def memory_utilisation_window(connection, tracePath, steps):
|
||||
|
||||
#windowSize/1000: picoseconds to nanoseconds conversion
|
||||
time = np.arange(0, (steps+1)*windowSize/1000, windowSize/1000)
|
||||
maxBandwidth = [maxDataRate/1024] * (steps+1)
|
||||
|
||||
plt.figure()
|
||||
|
||||
subplotIndex = 211
|
||||
plt.subplot(subplotIndex)
|
||||
#Plot Bandwidth in Percent
|
||||
plt.plot(time, bandwidthPercentage)
|
||||
plt.xlabel('Time [ns]')
|
||||
plt.ylabel('Bandwidth [%]')
|
||||
plt.ylim(-1, maximumPercentage + (10 - maximumPercentage%10))
|
||||
plt.grid(True)
|
||||
|
||||
subplotIndex += 1
|
||||
plt.subplot(subplotIndex)
|
||||
plt.plot(time, bandwidth)
|
||||
plt.xlabel('Time [ns]')
|
||||
plt.ylabel('Bandwidth [Gibit/s]')
|
||||
plt.ylim((-0.01)*float(maxDataRate)/1024, ((maximumPercentage + (10 - maximumPercentage%10))/100)*float(maxDataRate)/1024)
|
||||
plt.grid(True)
|
||||
|
||||
pdf = PdfPages(OUTPUT_FILE)
|
||||
pdf = PdfPages(outputFileNamePercent)
|
||||
pdf.savefig()
|
||||
pdf.close()
|
||||
plt.close()
|
||||
return outputFile
|
||||
|
||||
#Plot absolute bandwidth
|
||||
plt.plot(time, bandwidth)
|
||||
plt.plot(time, maxBandwidth)
|
||||
plt.xlabel('Time [ns]')
|
||||
plt.ylabel('Bandwidth [Gibit/s]')
|
||||
#plt.ylim((-0.01)*float(maxDataRate)/1024, ((maximumPercentage + (10 - maximumPercentage%10))/100)*float(maxDataRate)/1024)
|
||||
plt.grid(True)
|
||||
|
||||
pdf = PdfPages(outputFileNameGBPS)
|
||||
pdf.savefig()
|
||||
pdf.close()
|
||||
plt.close()
|
||||
return outputFiles
|
||||
|
||||
@plot
|
||||
def power_window(connection, tracePath, steps):
|
||||
@@ -123,8 +132,8 @@ def power_window(connection, tracePath, steps):
|
||||
name = ntpath.basename(tracePath)
|
||||
basename, extension = os.path.splitext(name)
|
||||
|
||||
OUTPUT_FILE = 'power_' + basename + '.pdf'
|
||||
outputFile = "\n" + "Output file is {0}".format(OUTPUT_FILE)
|
||||
outputFileName = 'power_' + basename + '.pdf'
|
||||
outputFile = "\n" + "Output file is {0}".format(outputFileName)
|
||||
|
||||
import matplotlib.pyplot as plt
|
||||
from matplotlib.backends.backend_pdf import PdfPages
|
||||
@@ -133,7 +142,7 @@ def power_window(connection, tracePath, steps):
|
||||
plt.xlabel('Time [ns]')
|
||||
plt.ylabel('Power [mW]')
|
||||
plt.grid(True)
|
||||
pdf = PdfPages(OUTPUT_FILE)
|
||||
pdf = PdfPages(outputFileName)
|
||||
pdf.savefig()
|
||||
pdf.close()
|
||||
plt.close()
|
||||
@@ -144,14 +153,14 @@ def latency_histogram(connection, tracePath, steps):
|
||||
# This function plots an histogram with access latencys
|
||||
outputFile = ""
|
||||
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\" ")
|
||||
cursor.execute("SELECT ((p2.PhaseEnd - p1.PhaseBegin)/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()
|
||||
|
||||
name = ntpath.basename(tracePath)
|
||||
basename, extension = os.path.splitext(name)
|
||||
|
||||
OUTPUT_FILE = 'hist_' + basename + '.pdf'
|
||||
outputFile = "\n" + "Output file is {0}".format(OUTPUT_FILE)
|
||||
outputFileName = 'hist_' + basename + '.pdf'
|
||||
outputFile = "\n" + "Output file is {0}".format(outputFileName)
|
||||
|
||||
numberOfBins=50
|
||||
|
||||
@@ -161,7 +170,7 @@ def latency_histogram(connection, tracePath, steps):
|
||||
plt.grid(True)
|
||||
plt.xlabel("Access Time [ns]")
|
||||
plt.ylabel("Number (Frequency)")
|
||||
pdf = PdfPages(OUTPUT_FILE)
|
||||
pdf = PdfPages(outputFileName)
|
||||
pdf.savefig()
|
||||
pdf.close()
|
||||
plt.close()
|
||||
|
||||
Reference in New Issue
Block a user