diff --git a/DRAMSys/traceAnalyzer/scripts/metrics.py b/DRAMSys/traceAnalyzer/scripts/metrics.py index 24bf8e1e..1b6e73ce 100644 --- a/DRAMSys/traceAnalyzer/scripts/metrics.py +++ b/DRAMSys/traceAnalyzer/scripts/metrics.py @@ -50,6 +50,14 @@ def average_response_latency_in_ns(connection): return round(result[0], 1) +@metric +def max_response_latency_in_ns(connection): + cursor = connection.cursor() + cursor.execute(""" SELECT max(RESP.PHASEBEGIN - REQ.PHASEBEGIN)/1000 FROM PHASES REQ, PHASES RESP WHERE REQ.PHASENAME = 'REQ' AND RESP.PHASENAME='RESP' AND REQ.TRANSACT = RESP.TRANSACT """) + result = cursor.fetchone() + return result[0] + + @metric def trans_with_max_response_latency(connection): cursor = connection.cursor() diff --git a/DRAMSys/traceAnalyzer/scripts/plots.py b/DRAMSys/traceAnalyzer/scripts/plots.py index d0a52cc3..7576fd8a 100755 --- a/DRAMSys/traceAnalyzer/scripts/plots.py +++ b/DRAMSys/traceAnalyzer/scripts/plots.py @@ -4,6 +4,8 @@ from memUtil import * from math import * import ntpath import os +numberOfBins = "auto" +latencyRange = None plots = [] @@ -236,7 +238,7 @@ def latency_histogram(connection, tracePath, steps): import matplotlib.pyplot as plt from matplotlib.backends.backend_pdf import PdfPages - plt.hist(dataArray, histtype='bar', facecolor='green') + plt.hist(dataArray, bins=numberOfBins, range=latencyRange, histtype='bar', facecolor='green') plt.grid(True) plt.xlabel("Access Time [ns]") plt.ylabel("Number of Accesses (Frequency)") @@ -312,4 +314,8 @@ def generatePlots(pathToTrace): if __name__ == "__main__": path = sys.argv[1] + if ((len(sys.argv)) > 2): + latencyRange = (0, int(sys.argv[2])) # Optional argument to use a different range + if ((len(sys.argv)) > 3): + numberOfBins = int(sys.argv[3]) # Optional argument to use a different number of bins generatePlots(path)