From 8ed200dfa32e41809ba526fcae8c9fe7082e17aa Mon Sep 17 00:00:00 2001 From: Matthias Jung Date: Wed, 28 May 2014 14:35:45 +0200 Subject: [PATCH] New metric script that plots a histogram, prerequisites install script added --- .gitignore | 11 +++++++++++ dram/.gitignore | 6 ------ dram/dramSys/dramSys.pro | 6 ++++-- dram/resources/configs/memconfigs/fifo.xml | 2 +- dram/resources/scripts/metrics.py | 14 +++++++++++++- dram/resources/simulations/sim-batch.xml | 3 +-- dram/src/common/libDRAMPower.cpp | 5 +++++ dram/src/common/libDRAMPower.h | 10 ++++++++++ install_prerequisites.sh | 8 ++++++++ 9 files changed, 53 insertions(+), 12 deletions(-) create mode 100644 .gitignore delete mode 100644 dram/.gitignore create mode 100644 dram/src/common/libDRAMPower.cpp create mode 100644 dram/src/common/libDRAMPower.h create mode 100755 install_prerequisites.sh diff --git a/.gitignore b/.gitignore new file mode 100644 index 00000000..57b0cd3d --- /dev/null +++ b/.gitignore @@ -0,0 +1,11 @@ +/debug +/release +*.tdb +*.tdb-journal +*.out +*.txt +/build-simulation +/release-simulation +/dram/src/common/third_party/DRAMPower/* +*.*~ +dram/build-*/ diff --git a/dram/.gitignore b/dram/.gitignore deleted file mode 100644 index 58658cf3..00000000 --- a/dram/.gitignore +++ /dev/null @@ -1,6 +0,0 @@ -/debug -/release -*.tdb -*.tdb-journal -*.out -*.txt diff --git a/dram/dramSys/dramSys.pro b/dram/dramSys/dramSys.pro index 6fed9296..128dd852 100644 --- a/dram/dramSys/dramSys.pro +++ b/dram/dramSys/dramSys.pro @@ -64,7 +64,8 @@ SOURCES += \ ../src/simulation/SimulationManager.cpp \ ../src/simulation/Simulation.cpp \ ../src/simulation/MemoryManager.cpp \ - ../src/simulation/main.cpp + ../src/simulation/main.cpp \ + ../src/common/libDRAMPower.cpp HEADERS += \ ../src/common/third_party/tinyxml2.h \ @@ -118,6 +119,7 @@ HEADERS += \ ../src/simulation/MemoryManager.h \ ../src/simulation/ISimulation.h \ ../src/simulation/Dram.h \ - ../src/simulation/Arbiter.h + ../src/simulation/Arbiter.h \ + ../src/common/libDRAMPower.h diff --git a/dram/resources/configs/memconfigs/fifo.xml b/dram/resources/configs/memconfigs/fifo.xml index d5e5fba2..f023bd90 100644 --- a/dram/resources/configs/memconfigs/fifo.xml +++ b/dram/resources/configs/memconfigs/fifo.xml @@ -4,7 +4,7 @@ - + diff --git a/dram/resources/scripts/metrics.py b/dram/resources/scripts/metrics.py index c84734af..6b1940db 100644 --- a/dram/resources/scripts/metrics.py +++ b/dram/resources/scripts/metrics.py @@ -32,6 +32,18 @@ def getTraceLength(connection): result = cursor.fetchone() return result[0] +@metric +def latency_histogram(connection): + 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\" ") + result = cursor.fetchall() + #result.sort() + #print(max(result)[0]) + import matplotlib.pyplot as plt + plt.hist(result, bins=max(result)[0], histtype='barstacked') + plt.savefig('hist.png') + return "Saved as hist.png" + @metric def average_response_latency_in_ns(connection): cursor = connection.cursor() @@ -271,7 +283,7 @@ def calculateMetrics(pathToTrace): #calculatedMetrics.extend(passRatio(connection)) #calculatedMetrics.extend(timeInPowerStates(connection)) - refreshMissDecision(connection, calculatedMetrics) + #refreshMissDecision(connection, calculatedMetrics) print(calculatedMetrics[-1]) print(calculatedMetrics[-2]) connection.close() diff --git a/dram/resources/simulations/sim-batch.xml b/dram/resources/simulations/sim-batch.xml index e2ba4924..a80fdf9c 100644 --- a/dram/resources/simulations/sim-batch.xml +++ b/dram/resources/simulations/sim-batch.xml @@ -9,12 +9,11 @@ fifo.xml - fr_fcfs.xml - test2.stl + trace3.stl diff --git a/dram/src/common/libDRAMPower.cpp b/dram/src/common/libDRAMPower.cpp new file mode 100644 index 00000000..8a6ae82b --- /dev/null +++ b/dram/src/common/libDRAMPower.cpp @@ -0,0 +1,5 @@ +#include "libdrampower.h" + +libDRAMPower::libDRAMPower() +{ +} diff --git a/dram/src/common/libDRAMPower.h b/dram/src/common/libDRAMPower.h new file mode 100644 index 00000000..9b1ca0b5 --- /dev/null +++ b/dram/src/common/libDRAMPower.h @@ -0,0 +1,10 @@ +#ifndef LIBDRAMPOWER_H +#define LIBDRAMPOWER_H + +class libDRAMPower +{ +public: + libDRAMPower(); +}; + +#endif // LIBDRAMPOWER_H diff --git a/install_prerequisites.sh b/install_prerequisites.sh new file mode 100755 index 00000000..7fb677b3 --- /dev/null +++ b/install_prerequisites.sh @@ -0,0 +1,8 @@ +#!/bin/bash +mkdir -p dram/src/common/third_party/DRAMPower +cd dram/src/common/third_party/DRAMPower +wget "http://www.es.ele.tue.nl/drampower/DRAMPower3.1.zip" +unzip DRAMPower3.1.zip +mv DRAMPower3.1/* . +rm -r DRAMPower3.1 +rm -r DRAMPower3.1.zip