From 2b99e82cffa7ed5e3b3154ba599dced289a48ba3 Mon Sep 17 00:00:00 2001 From: Felipe Salerno Prado Date: Tue, 23 Feb 2016 16:29:30 +0100 Subject: [PATCH 1/3] Bandwidth Over Time Graphics and Absolute Bandwidth as Text --- DRAMSys/analyzer/scripts/metrics.py | 100 +++++++++++++++++++++++++++- 1 file changed, 99 insertions(+), 1 deletion(-) diff --git a/DRAMSys/analyzer/scripts/metrics.py b/DRAMSys/analyzer/scripts/metrics.py index 80b01972..fa0e2bb3 100644 --- a/DRAMSys/analyzer/scripts/metrics.py +++ b/DRAMSys/analyzer/scripts/metrics.py @@ -1,6 +1,7 @@ import sys import sqlite3 from memUtil import * +from math import * metrics = [] threadMetrics = [] @@ -114,6 +115,104 @@ def memory_utilisation_percent_new(connection): idle = memory_idle(connection) return (active/(total-idle))*100 +@metric +def memory_utilisation_new(connection): + #This function calculates the memory utilisation in Gbit/s considering the memory_utilisation_percent_new function result. + memory_utilisation_window_new(connection) + maxDataRate = maximum_data_rate(connection) + memoryPercent = memory_utilisation_percent_new(connection) + return (memoryPercent/100)*(maxDataRate/1024) + +def memory_utilisation_window_new(connection): + #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 the data from the database, DataStrobeEnd and DataStrobeBegin, it is possible to assess when a data transfer begins or ends. + #Hence, it is possible to ckeck when a data transfer happens and if it occupies or is inside a time window. Then, it is possible to determine the average bandwidth in percentage. + #Besides, extracting the data from the memory specs, it is possible 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. + + windowSize = 1000000 + cursor = connection.cursor() + cursor.execute(""" SELECT max(DataStrobeEnd) FROM Transactions """) + total = cursor.fetchone() + steps = ceil(float(total[0])/float(windowSize)) + #print(steps) + #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 + bandwidth = [0] * steps + for i in range(steps): + #print(i) + bandwidthPercentage[i] = 0 + cursor.execute(queryPart, (i*windowSize, (i+1)*windowSize)) + result = cursor.fetchone() + if(result is None): + cursor.execute(queryFull, (i*windowSize, (i+1)*windowSize)) + result = cursor.fetchone() + if(result[0] is not None): + bandwidthPercentage[i] += int(result[0]) + #print(bandwidthPercentage[i]) + cursor.execute(queryEnd, (i*windowSize,i*windowSize,i*windowSize,(i+1)*windowSize)) + result = cursor.fetchone() + if(result[0] is not None): + bandwidthPercentage[i] += int(result[0]) + #print(bandwidthPercentage[i]) + cursor.execute(queryBegin, ((i+1)*windowSize, i*windowSize, (i+1)*windowSize, (i+1)*windowSize)) + result = cursor.fetchone() + if(result[0] is not None): + bandwidthPercentage[i] += int(result[0]) + #print(bandwidthPercentage[i]) + else: + bandwidthPercentage[i] = windowSize + #print(bandwidthPercentage[i]) + bandwidthPercentage[i] = float(bandwidthPercentage[i]/windowSize) + bandwidth[i] = float(bandwidthPercentage[i])*float(maxDataRate)/1024 + bandwidthPercentage[i] *= 100 + + import matplotlib.pyplot as plt + import numpy as np + from matplotlib.backends.backend_pdf import PdfPages + + time = np.arange(0,steps*windowSize,windowSize) + + plt.figure(1) + plt.plot(time/1000,bandwidthPercentage) + plt.xlabel('Time (ns)') + plt.ylabel('Bandwidth (%)') + plt.ylim(0,120) + plt.grid(True) + windowPercentage = PdfPages('windowPercentage.pdf') + windowPercentage.savefig() + windowPercentage.close() + + plt.figure(2) + plt.plot(time/1000,bandwidth) + plt.xlabel('Time (ns)') + plt.ylabel('Bandwidth (Gbit/s)') + plt.grid(True) + window = PdfPages('window.pdf') + window.savefig() + window.close() + +def maximum_data_rate(connection): + memspec = MemSpec(connection) + memoryType = memspec.getValue("memoryType") + if (memoryType.find("DDR") != -1): + width = 64 + else: + if (memoryType.find("WIDEIO") != -1): + width = memspec.getValue("width") + clk = memspec.getValue("clkMhz") + rate = memspec.getValue("dataRate") + maxDataRate = float(clk)*float(width)*float(rate) + return maxDataRate @metric def memory_utilisation_percent_old(connection): @@ -330,7 +429,6 @@ def time_in_power_down_states_percent(connection): totalTimeAllBanks = trace_length_in_ns(connection) * getNumberOfBanks(connection) return (time_in_power_down_states_in_ns(connection) * 1.0 / totalTimeAllBanks) * 100 - def passRatio(connection): numberOfPassWins = {} From 5887c4be6ad9dd15f955afa48a6d8d686db1b151 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89der=20F=2E=20Zulian?= Date: Fri, 26 Feb 2016 08:49:44 -0300 Subject: [PATCH 2/3] Created a specific button to generate plots This makes possible to generate metrics without waiting for the plots generation. --- .../analyzer/businessObjects/pythoncaller.cpp | 19 ++- .../analyzer/businessObjects/pythoncaller.h | 5 + DRAMSys/analyzer/evaluationtool.cpp | 21 ++++ DRAMSys/analyzer/evaluationtool.h | 5 +- DRAMSys/analyzer/evaluationtool.ui | 7 ++ DRAMSys/analyzer/scripts/memUtil.py | 14 +++ DRAMSys/analyzer/scripts/metrics.py | 97 +--------------- DRAMSys/analyzer/scripts/plots.py | 108 ++++++++++++++++++ DRAMSys/analyzer/scripts/tests.py | 0 DRAMSys/analyzer/traceAnalyzer.pro | 3 +- DRAMSys/analyzer/traceanalyzer.cpp | 1 - 11 files changed, 183 insertions(+), 97 deletions(-) mode change 100644 => 100755 DRAMSys/analyzer/scripts/memUtil.py create mode 100644 DRAMSys/analyzer/scripts/plots.py mode change 100644 => 100755 DRAMSys/analyzer/scripts/tests.py diff --git a/DRAMSys/analyzer/businessObjects/pythoncaller.cpp b/DRAMSys/analyzer/businessObjects/pythoncaller.cpp index c300431b..27693d37 100644 --- a/DRAMSys/analyzer/businessObjects/pythoncaller.cpp +++ b/DRAMSys/analyzer/businessObjects/pythoncaller.cpp @@ -50,7 +50,9 @@ PythonCaller::PythonCaller() : testFunctionName("runTests"), metricModuleName("metrics"), metricFunctionName("calculateMetrics"), - pathToScripts(QApplication::applicationDirPath().toStdString() + "/../../DRAMSys/analyzer/scripts/") + pathToScripts(QApplication::applicationDirPath().toStdString() + "/../../DRAMSys/analyzer/scripts/"), + plotsModuleName("plots"), + plotsFunctionName("generatePlots") { Py_Initialize(); PyObject *sysPath = PySys_GetObject((char*)"path"); @@ -59,10 +61,13 @@ PythonCaller::PythonCaller() : Py_DECREF(path); qDebug() << testModuleName.c_str() << testFunctionName.c_str(); + qDebug() << metricModuleName.c_str() << metricFunctionName.c_str(); + qDebug() << plotsModuleName.c_str() << plotsFunctionName.c_str(); qDebug() << "XXX: " << pathToScripts.c_str(); pRunTestsFunction = loadFunctionFromModule(testModuleName, testFunctionName); pCalculateMetricsFunction = loadFunctionFromModule(metricModuleName, metricFunctionName); + pGenPlotsFunction = loadFunctionFromModule(plotsModuleName, plotsFunctionName); } @@ -93,6 +98,7 @@ PythonCaller::~PythonCaller() { Py_DECREF(pRunTestsFunction); Py_DECREF(pCalculateMetricsFunction); + Py_DECREF(pGenPlotsFunction); Py_Finalize(); } @@ -149,3 +155,14 @@ TraceCalculatedMetrics PythonCaller::calculateMetricsOnTrace(QString pathToTrace Py_DECREF(pResult); return result; } + +void PythonCaller::generatePlotsOnTrace(QString pathToTrace) +{ + assert(PyCallable_Check(pGenPlotsFunction)); + + PyObject *pArgs = PyTuple_New(1); + PyObject *pArgument = PyUnicode_FromString(pathToTrace.toStdString().c_str()); + PyTuple_SetItem(pArgs, 0, pArgument); + PyObject_CallObject(pGenPlotsFunction, pArgs); + Py_DECREF(pArgument); +} diff --git a/DRAMSys/analyzer/businessObjects/pythoncaller.h b/DRAMSys/analyzer/businessObjects/pythoncaller.h index 3251a7fb..361078c3 100644 --- a/DRAMSys/analyzer/businessObjects/pythoncaller.h +++ b/DRAMSys/analyzer/businessObjects/pythoncaller.h @@ -50,11 +50,16 @@ public: ~PythonCaller(); TraceTestResults runTestsOnTrace(QString pathToTrace); TraceCalculatedMetrics calculateMetricsOnTrace(QString pathToTrace); + void generatePlotsOnTrace(QString pathToTrace); private: PyObject *pRunTestsFunction, *pCalculateMetricsFunction; + PyObject *pGenPlotsFunction; PyObject* loadFunctionFromModule(std::string moduleName, std::string functionName); std::string testModuleName, testFunctionName, metricModuleName, metricFunctionName, pathToScripts; + std::string plotsModuleName; + std::string plotsFunctionName; + PyObject *callFunctionWithStringArgument(PyObject *function, QString argument); }; diff --git a/DRAMSys/analyzer/evaluationtool.cpp b/DRAMSys/analyzer/evaluationtool.cpp index e36b117a..f9d21323 100644 --- a/DRAMSys/analyzer/evaluationtool.cpp +++ b/DRAMSys/analyzer/evaluationtool.cpp @@ -33,6 +33,7 @@ * Janik Schlemminger * Robert Gernhardt * Matthias Jung + * Éder F. Zulian */ #include @@ -203,3 +204,23 @@ void EvaluationTool::on_btn_exportCSV_clicked() } } + +void EvaluationTool::on_btn_genPlots_clicked() +{ + genPlots(); +} + +void EvaluationTool::genPlots() +{ + ui->traceMetricTreeWidget->clear(); + + if(traceFilesModel->rowCount() == 0) + return; + + PythonCaller pythonCaller; + for (int row = 0; row < traceFilesModel->rowCount(); ++row) { + TraceFileItem *item = static_cast(traceFilesModel->item(row)); + pythonCaller.generatePlotsOnTrace(item->getPath()); + } + ui->traceMetricTreeWidget->expandAll(); +} diff --git a/DRAMSys/analyzer/evaluationtool.h b/DRAMSys/analyzer/evaluationtool.h index 36f250c1..e6e66a7c 100644 --- a/DRAMSys/analyzer/evaluationtool.h +++ b/DRAMSys/analyzer/evaluationtool.h @@ -33,6 +33,7 @@ * Janik Schlemminger * Robert Gernhardt * Matthias Jung + * Éder F. Zulian */ #ifndef EVALUATIONTOOL_H @@ -69,14 +70,16 @@ private Q_SLOTS: void on_btn_test_clicked(); void setTestMessage(QString message); void on_btn_calculateMetrics_clicked(); - void on_btn_exportCSV_clicked(); + void on_btn_genPlots_clicked(); + private: void fillFileList(QList paths); void runTests(); void calculateMetrics(); void cleanUpUI(); + void genPlots(); Ui::EvaluationTool *ui; diff --git a/DRAMSys/analyzer/evaluationtool.ui b/DRAMSys/analyzer/evaluationtool.ui index 0b773843..cec14f63 100644 --- a/DRAMSys/analyzer/evaluationtool.ui +++ b/DRAMSys/analyzer/evaluationtool.ui @@ -137,6 +137,13 @@ + + + + Generate plots + + + diff --git a/DRAMSys/analyzer/scripts/memUtil.py b/DRAMSys/analyzer/scripts/memUtil.py old mode 100644 new mode 100755 index 2bc5a26e..037e936b --- a/DRAMSys/analyzer/scripts/memUtil.py +++ b/DRAMSys/analyzer/scripts/memUtil.py @@ -55,3 +55,17 @@ def getNumberOfBanks(dbconnection): cursor.execute("SELECT NumberOfBanks FROM generalInfo") result = cursor.fetchone() return result[0] + + +def maximum_data_rate(connection): + memspec = MemSpec(connection) + memoryType = memspec.getValue("memoryType") + if (memoryType.find("DDR") != -1): + width = 64 + else: + if (memoryType.find("WIDEIO") != -1): + width = memspec.getValue("width") + clk = memspec.getValue("clkMhz") + rate = memspec.getValue("dataRate") + maxDataRate = float(clk)*float(width)*float(rate) + return maxDataRate diff --git a/DRAMSys/analyzer/scripts/metrics.py b/DRAMSys/analyzer/scripts/metrics.py index fa0e2bb3..5d066c03 100644 --- a/DRAMSys/analyzer/scripts/metrics.py +++ b/DRAMSys/analyzer/scripts/metrics.py @@ -115,104 +115,14 @@ def memory_utilisation_percent_new(connection): idle = memory_idle(connection) return (active/(total-idle))*100 + @metric -def memory_utilisation_new(connection): - #This function calculates the memory utilisation in Gbit/s considering the memory_utilisation_percent_new function result. - memory_utilisation_window_new(connection) +def memory_utilisation_in_Gbps(connection): + # This function calculates the memory utilisation in Gbit/s considering the memory_utilisation_percent_new function result. maxDataRate = maximum_data_rate(connection) memoryPercent = memory_utilisation_percent_new(connection) return (memoryPercent/100)*(maxDataRate/1024) -def memory_utilisation_window_new(connection): - #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 the data from the database, DataStrobeEnd and DataStrobeBegin, it is possible to assess when a data transfer begins or ends. - #Hence, it is possible to ckeck when a data transfer happens and if it occupies or is inside a time window. Then, it is possible to determine the average bandwidth in percentage. - #Besides, extracting the data from the memory specs, it is possible 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. - - windowSize = 1000000 - cursor = connection.cursor() - cursor.execute(""" SELECT max(DataStrobeEnd) FROM Transactions """) - total = cursor.fetchone() - steps = ceil(float(total[0])/float(windowSize)) - #print(steps) - #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 - bandwidth = [0] * steps - for i in range(steps): - #print(i) - bandwidthPercentage[i] = 0 - cursor.execute(queryPart, (i*windowSize, (i+1)*windowSize)) - result = cursor.fetchone() - if(result is None): - cursor.execute(queryFull, (i*windowSize, (i+1)*windowSize)) - result = cursor.fetchone() - if(result[0] is not None): - bandwidthPercentage[i] += int(result[0]) - #print(bandwidthPercentage[i]) - cursor.execute(queryEnd, (i*windowSize,i*windowSize,i*windowSize,(i+1)*windowSize)) - result = cursor.fetchone() - if(result[0] is not None): - bandwidthPercentage[i] += int(result[0]) - #print(bandwidthPercentage[i]) - cursor.execute(queryBegin, ((i+1)*windowSize, i*windowSize, (i+1)*windowSize, (i+1)*windowSize)) - result = cursor.fetchone() - if(result[0] is not None): - bandwidthPercentage[i] += int(result[0]) - #print(bandwidthPercentage[i]) - else: - bandwidthPercentage[i] = windowSize - #print(bandwidthPercentage[i]) - bandwidthPercentage[i] = float(bandwidthPercentage[i]/windowSize) - bandwidth[i] = float(bandwidthPercentage[i])*float(maxDataRate)/1024 - bandwidthPercentage[i] *= 100 - - import matplotlib.pyplot as plt - import numpy as np - from matplotlib.backends.backend_pdf import PdfPages - - time = np.arange(0,steps*windowSize,windowSize) - - plt.figure(1) - plt.plot(time/1000,bandwidthPercentage) - plt.xlabel('Time (ns)') - plt.ylabel('Bandwidth (%)') - plt.ylim(0,120) - plt.grid(True) - windowPercentage = PdfPages('windowPercentage.pdf') - windowPercentage.savefig() - windowPercentage.close() - - plt.figure(2) - plt.plot(time/1000,bandwidth) - plt.xlabel('Time (ns)') - plt.ylabel('Bandwidth (Gbit/s)') - plt.grid(True) - window = PdfPages('window.pdf') - window.savefig() - window.close() - -def maximum_data_rate(connection): - memspec = MemSpec(connection) - memoryType = memspec.getValue("memoryType") - if (memoryType.find("DDR") != -1): - width = 64 - else: - if (memoryType.find("WIDEIO") != -1): - width = memspec.getValue("width") - clk = memspec.getValue("clkMhz") - rate = memspec.getValue("dataRate") - maxDataRate = float(clk)*float(width)*float(rate) - return maxDataRate @metric def memory_utilisation_percent_old(connection): @@ -429,6 +339,7 @@ def time_in_power_down_states_percent(connection): totalTimeAllBanks = trace_length_in_ns(connection) * getNumberOfBanks(connection) return (time_in_power_down_states_in_ns(connection) * 1.0 / totalTimeAllBanks) * 100 + def passRatio(connection): numberOfPassWins = {} diff --git a/DRAMSys/analyzer/scripts/plots.py b/DRAMSys/analyzer/scripts/plots.py new file mode 100644 index 00000000..bf1ad598 --- /dev/null +++ b/DRAMSys/analyzer/scripts/plots.py @@ -0,0 +1,108 @@ +import sys +import sqlite3 +from memUtil import * +from math import * + +plots = [] + + +def plot(function): + plots.append(function) + return function + + +@plot +def memory_utilisation_window(connection): + # 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 the data from the database, DataStrobeEnd and DataStrobeBegin, it is possible to assess when a data transfer begins or ends. + # Hence, it is possible to ckeck when a data transfer happens and if it occupies or is inside a time window. Then, it is possible to determine the average bandwidth in percentage. + # Besides, extracting the data from the memory specs, it is possible 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. + + windowSize = 1000000 + cursor = connection.cursor() + cursor.execute(""" SELECT max(DataStrobeEnd) FROM Transactions """) + total = cursor.fetchone() + steps = ceil(float(total[0])/float(windowSize)) + # print(steps) + # 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 + bandwidth = [0] * steps + for i in range(steps): + # print(i) + bandwidthPercentage[i] = 0 + cursor.execute(queryPart, (i*windowSize, (i+1)*windowSize)) + result = cursor.fetchone() + if(result is None): + cursor.execute(queryFull, (i*windowSize, (i+1)*windowSize)) + result = cursor.fetchone() + if(result[0] is not None): + bandwidthPercentage[i] += int(result[0]) + # print(bandwidthPercentage[i]) + cursor.execute(queryEnd, (i*windowSize, i*windowSize, i*windowSize, (i+1)*windowSize)) + result = cursor.fetchone() + if(result[0] is not None): + bandwidthPercentage[i] += int(result[0]) + # print(bandwidthPercentage[i]) + cursor.execute(queryBegin, ((i+1)*windowSize, i*windowSize, (i+1)*windowSize, (i+1)*windowSize)) + result = cursor.fetchone() + if(result[0] is not None): + bandwidthPercentage[i] += int(result[0]) + # print(bandwidthPercentage[i]) + else: + bandwidthPercentage[i] = windowSize + # print(bandwidthPercentage[i]) + bandwidthPercentage[i] = float(bandwidthPercentage[i]/windowSize) + bandwidth[i] = float(bandwidthPercentage[i])*float(maxDataRate)/1024 + bandwidthPercentage[i] *= 100 + + import matplotlib.pyplot as plt + import numpy as np + from matplotlib.backends.backend_pdf import PdfPages + + time = np.arange(0, steps*windowSize, windowSize) + + plt.figure(1) + plt.plot(time/1000, bandwidthPercentage) + plt.xlabel('Time (ns)') + plt.ylabel('Bandwidth (%)') + plt.ylim(0, 120) + plt.grid(True) + windowPercentage = PdfPages('windowPercentage.pdf') + windowPercentage.savefig() + windowPercentage.close() + + plt.figure(2) + plt.plot(time/1000, bandwidth) + plt.xlabel('Time (ns)') + plt.ylabel('Bandwidth (Gbit/s)') + plt.grid(True) + window = PdfPages('window.pdf') + window.savefig() + window.close() + + +def generatePlots(pathToTrace): + connection = sqlite3.connect(pathToTrace) + + print("================================") + print("Generating plots for {0}".format(pathToTrace)) + + for p in plots: + p(connection) + + connection.close() + + +if __name__ == "__main__": + path = sys.argv[1] + generatePlots(path) diff --git a/DRAMSys/analyzer/scripts/tests.py b/DRAMSys/analyzer/scripts/tests.py old mode 100644 new mode 100755 diff --git a/DRAMSys/analyzer/traceAnalyzer.pro b/DRAMSys/analyzer/traceAnalyzer.pro index e32a37de..ea81043c 100644 --- a/DRAMSys/analyzer/traceAnalyzer.pro +++ b/DRAMSys/analyzer/traceAnalyzer.pro @@ -100,7 +100,8 @@ FORMS += \ OTHER_FILES += \ common/static/createTraceDB.sql \ scripts/metrics.py \ - scripts/tests.py + scripts/tests.py \ + scripts/plots.py QMAKE_CXXFLAGS += -std=c++11 QMAKE_CXXFLAGS += -Xlinker -export-dynamic diff --git a/DRAMSys/analyzer/traceanalyzer.cpp b/DRAMSys/analyzer/traceanalyzer.cpp index c3e9e3e2..bffd186b 100644 --- a/DRAMSys/analyzer/traceanalyzer.cpp +++ b/DRAMSys/analyzer/traceanalyzer.cpp @@ -209,4 +209,3 @@ void TraceAnalyzer::on_actionMetrics_triggered() evaluationTool.activateWindow(); evaluationTool.showAndEvaluateMetrics(openedTraceFiles.toList()); } - From 3a0b9142dfa5c05f78fb68aa3e46542bf296f99e Mon Sep 17 00:00:00 2001 From: sprado Date: Fri, 26 Feb 2016 15:47:19 +0100 Subject: [PATCH 3/3] Bar Charts --- DRAMSys/analyzer/scripts/metrics.py | 2 +- DRAMSys/analyzer/scripts/plots.py | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/DRAMSys/analyzer/scripts/metrics.py b/DRAMSys/analyzer/scripts/metrics.py index 5d066c03..0dd10e46 100644 --- a/DRAMSys/analyzer/scripts/metrics.py +++ b/DRAMSys/analyzer/scripts/metrics.py @@ -121,7 +121,7 @@ def memory_utilisation_in_Gbps(connection): # This function calculates the memory utilisation in Gbit/s considering the memory_utilisation_percent_new function result. maxDataRate = maximum_data_rate(connection) memoryPercent = memory_utilisation_percent_new(connection) - return (memoryPercent/100)*(maxDataRate/1024) + return (memoryPercent/100)*(maxDataRate/1000) @metric diff --git a/DRAMSys/analyzer/scripts/plots.py b/DRAMSys/analyzer/scripts/plots.py index bf1ad598..e0ce7194 100644 --- a/DRAMSys/analyzer/scripts/plots.py +++ b/DRAMSys/analyzer/scripts/plots.py @@ -62,7 +62,7 @@ def memory_utilisation_window(connection): bandwidthPercentage[i] = windowSize # print(bandwidthPercentage[i]) bandwidthPercentage[i] = float(bandwidthPercentage[i]/windowSize) - bandwidth[i] = float(bandwidthPercentage[i])*float(maxDataRate)/1024 + bandwidth[i] = float(bandwidthPercentage[i])*float(maxDataRate)/1000 bandwidthPercentage[i] *= 100 import matplotlib.pyplot as plt @@ -72,7 +72,7 @@ def memory_utilisation_window(connection): time = np.arange(0, steps*windowSize, windowSize) plt.figure(1) - plt.plot(time/1000, bandwidthPercentage) + plt.bar(time/1000, bandwidthPercentage, width = windowSize/1000) plt.xlabel('Time (ns)') plt.ylabel('Bandwidth (%)') plt.ylim(0, 120) @@ -82,7 +82,7 @@ def memory_utilisation_window(connection): windowPercentage.close() plt.figure(2) - plt.plot(time/1000, bandwidth) + plt.bar(time/1000, bandwidth, width = windowSize/1000) plt.xlabel('Time (ns)') plt.ylabel('Bandwidth (Gbit/s)') plt.grid(True)