diff --git a/DRAMSys/analyzer/scripts/memUtil.py b/DRAMSys/analyzer/scripts/memUtil.py index 5ef8b377..eed3fe2b 100755 --- a/DRAMSys/analyzer/scripts/memUtil.py +++ b/DRAMSys/analyzer/scripts/memUtil.py @@ -29,7 +29,9 @@ class MemSpec(object): proper format when searching for elements. """ def getValue(self, id): - return self.xmlMemSpec.findall(".//parameter[@id='{0}']".format(id))[0].attrib['value'] + match = ".//parameter[@id='{0}']".format(id) + val = self.xmlMemSpec.findall(match)[0].attrib['value'] + return val def getIntValue(self, id): return int(self.getValue(id)) @@ -54,12 +56,14 @@ def getNumberOfBanks(dbconnection): result = cursor.fetchone() return result[0] + def getWindowSize(connection): cursor = connection.cursor() cursor.execute(" SELECT WindowSize FROM GeneralInfo ") windowSize = float(cursor.fetchone()[0]) return windowSize + def maximum_data_rate(connection): memspec = MemSpec(connection) memoryType = memspec.getValue("memoryType") diff --git a/DRAMSys/analyzer/scripts/plots.py b/DRAMSys/analyzer/scripts/plots.py index be019285..57087064 100755 --- a/DRAMSys/analyzer/scripts/plots.py +++ b/DRAMSys/analyzer/scripts/plots.py @@ -85,7 +85,7 @@ def memory_utilisation_window_thread(connection, tracePath, steps, thread_ID): bandwidthPercentage, bandwidth, maximumPercentage = calculate_bandwidth_util(connection, windowSize, steps, queryFull, queryEnd, queryBegin, queryPart) - outputFileNameBWMatlab, basename = createOutputFilename(tracePath, 'memory_utilization_percent_', 'thread_' + str(thread_ID) + '_', 'txt') + outputFileNameBWMatlab, basename = createOutputFilename(tracePath, 'memory_utilization_percent', 'thread_' + str(thread_ID) + '_', 'txt') return bandwidthPercentage, bandwidth, outputFileNameBWMatlab def plot(function): @@ -117,9 +117,9 @@ def memory_utilisation_window(connection, tracePath, steps): bandwidthPercentage, bandwidth, maximumPercentage = calculate_bandwidth_util(connection, windowSize, steps, queryFull, queryEnd, queryBegin, queryPart) - outputFileNameGBPS, basename = createOutputFilename(tracePath, 'memory_utilization_gbps_', '', 'pdf') - outputFileNamePercent, basename = createOutputFilename(tracePath, 'memory_utilization_percent_', '', 'pdf') - outputFileNameBWMatlab, basename = createOutputFilename(tracePath, 'memory_utilization_percent_', '', 'txt') + outputFileNameGBPS, basename = createOutputFilename(tracePath, 'memory_utilization_gbps', '', 'pdf') + outputFileNamePercent, basename = createOutputFilename(tracePath, 'memory_utilization_percent', '', 'pdf') + outputFileNameBWMatlab, basename = createOutputFilename(tracePath, 'memory_utilization_percent', '', 'txt') outputFiles = "{0}\n\t{1}\n\t{2}\n\t".format(outputFileNameGBPS,outputFileNamePercent,outputFileNameBWMatlab) import matplotlib.pyplot as plt @@ -240,7 +240,7 @@ def latency_histogram(connection, tracePath, steps): plt.hist(dataArray, bins=numberOfBins, histtype='barstacked', facecolor='green') plt.grid(True) plt.xlabel("Access Time [ns]") - plt.ylabel("Number (Frequency)") + plt.ylabel("Number of Accesses (Frequency)") plt.title("Latency Histogram " + str(basename)) pdf = PdfPages(outputFileName) pdf.savefig() @@ -249,8 +249,8 @@ def latency_histogram(connection, tracePath, steps): def create_latency_hist(connection, tracePath, target_measurement, query): # form output file name - # outputFileName = 'hist_' + basename + '.pdf' - outputFileName, basename = createOutputFilename(tracePath, 'hist', target_measurement, 'pdf') + ofbname = 'access_latency_hist' + outputFileName, basename = createOutputFilename(tracePath, ofbname, target_measurement, 'pdf') # return log string outputFile = "{0}\n\t".format(outputFileName) # access database @@ -279,7 +279,8 @@ def latency_histogram(connection, tracePath, steps): AND p2.PhaseName = "RESP" AND t.TThread = {0} """ for thread in threads: - outputFile += create_latency_hist(connection, tracePath, 'thread_' + str(thread) + '_', queryThread.format(thread)) + thrname = 'thread_' + str(thread) + '_' + outputFile += create_latency_hist(connection, tracePath, thrname, queryThread.format(thread)) return outputFile