diff --git a/DRAMSys/simulator/resources/simulations/ddr3-example.xml b/DRAMSys/simulator/resources/simulations/ddr3-example.xml
index 0df2e1c7..776656ce 100644
--- a/DRAMSys/simulator/resources/simulations/ddr3-example.xml
+++ b/DRAMSys/simulator/resources/simulations/ddr3-example.xml
@@ -9,6 +9,7 @@
+
diff --git a/DRAMSys/simulator/resources/simulations/sim-batch.xml b/DRAMSys/simulator/resources/simulations/sim-batch.xml
index aaaba0a9..3ea21963 100644
--- a/DRAMSys/simulator/resources/simulations/sim-batch.xml
+++ b/DRAMSys/simulator/resources/simulations/sim-batch.xml
@@ -9,6 +9,7 @@
+
diff --git a/DRAMSys/simulator/src/controller/core/configuration/Configuration.cpp b/DRAMSys/simulator/src/controller/core/configuration/Configuration.cpp
index 975cc7a0..04ef17da 100644
--- a/DRAMSys/simulator/src/controller/core/configuration/Configuration.cpp
+++ b/DRAMSys/simulator/src/controller/core/configuration/Configuration.cpp
@@ -163,6 +163,8 @@ void Configuration::setParameter(std::string name, std::string value)
ControllerCoreDisableRefresh = string2bool(value);
else if (name == "ThermalSimulation")
ThermalSimulation = string2bool(value);
+ else if(name == "SimulationProgressBar")
+ SimulationProgressBar = string2bool(value);
// Specification for ErrorChipSeed, ErrorCSVFile path and ErrorStoreMode
else if(name == "ErrorChipSeed")
ErrorChipSeed = string2int(value);
diff --git a/DRAMSys/simulator/src/controller/core/configuration/Configuration.h b/DRAMSys/simulator/src/controller/core/configuration/Configuration.h
index 450e7bde..6c27b786 100644
--- a/DRAMSys/simulator/src/controller/core/configuration/Configuration.h
+++ b/DRAMSys/simulator/src/controller/core/configuration/Configuration.h
@@ -82,6 +82,7 @@ struct Configuration
unsigned int NumberOfMemChannels = 1;
bool ControllerCoreDisableRefresh = false;
bool ThermalSimulation = false;
+ bool SimulationProgressBar;
//MemSpec(from DRAM-Power XML)
MemSpec memSpec;
diff --git a/DRAMSys/simulator/src/simulation/Simulation.cpp b/DRAMSys/simulator/src/simulation/Simulation.cpp
index 750439db..b22216c8 100644
--- a/DRAMSys/simulator/src/simulation/Simulation.cpp
+++ b/DRAMSys/simulator/src/simulation/Simulation.cpp
@@ -124,15 +124,20 @@ void Simulation::instantiateModules(const string &traceName, const string &pathT
StlPlayer<> *newPlayer = new StlPlayer<>(playerStr.c_str(), pathToResources + string("traces/") + devices[i].trace, devices[i].clkMhz, this);
player = newPlayer;
newPlayer->getTraceLength(pathToResources + string("traces/") + devices[i].trace);
+ totalTransactions += newPlayer->getNumberOfLines(pathToResources + string("traces/") + devices[i].trace);
}
else
{
StlDataPlayer<> *newPlayer = new StlDataPlayer<>(playerStr.c_str(), pathToResources + string("traces/") + devices[i].trace, devices[i].clkMhz, this);
player = newPlayer;
newPlayer->getTraceLength(pathToResources + string("traces/") + devices[i].trace);
+ totalTransactions += newPlayer->getNumberOfLines(pathToResources + string("traces/") + devices[i].trace);
}
players.push_back(player);
}
+ remainingTransactions = totalTransactions;
+
+ //player->remainingTransactions = player->totalTransactions;
// Create and properly initialize TLM recorders. They need to be ready before creating some modules.
setupTlmRecorders(traceName, pathToResources, devices);
@@ -228,6 +233,17 @@ void Simulation::stop()
report("Simulation took " + to_string(elapsed_secs) + " seconds");
}
+
+void inline Simulation::transactionFinished()
+{
+ remainingTransactions--;
+ loadbar(totalTransactions - remainingTransactions, totalTransactions);
+ if (remainingTransactions == 0)
+ {
+ cout << endl;
+ }
+}
+
void Simulation::report(string message)
{
DebugManager::getInstance().printDebugMessage(this->name(), message);
diff --git a/DRAMSys/simulator/src/simulation/Simulation.h b/DRAMSys/simulator/src/simulation/Simulation.h
index 0721c763..3b5d24fb 100644
--- a/DRAMSys/simulator/src/simulation/Simulation.h
+++ b/DRAMSys/simulator/src/simulation/Simulation.h
@@ -86,6 +86,7 @@ public:
void stop();
virtual void tracePlayerTerminates() override;
+ virtual void transactionFinished() override;
private:
std::string traceName;
@@ -107,6 +108,9 @@ private:
// Transaction Recorders (one per channel). They generate the output databases.
std::vector tlmRecorders;
+ unsigned int totalTransactions = 0;
+ unsigned int remainingTransactions;
+
clock_t simulationStartTime;
void report(std::string message);
void setupTlmRecorders(const string &traceName, const string &pathToResources, const std::vector &devices);
diff --git a/DRAMSys/simulator/src/simulation/StlDataPlayer.h b/DRAMSys/simulator/src/simulation/StlDataPlayer.h
index 06c253d7..8c29b30b 100644
--- a/DRAMSys/simulator/src/simulation/StlDataPlayer.h
+++ b/DRAMSys/simulator/src/simulation/StlDataPlayer.h
@@ -177,6 +177,19 @@ public:
}
+ unsigned int getNumberOfLines(string pathToTrace)
+ {
+ ifstream newFile;
+ newFile.open(pathToTrace);
+ newFile.unsetf(std::ios_base::skipws); // new lines will be skipped unless we stop it from happening:
+ // count the newlines with an algorithm specialized for counting:
+ unsigned int lineCount = std::count(std::istream_iterator(newFile), std::istream_iterator(), '\n');
+
+ newFile.close();
+ return lineCount;
+ }
+
+
private:
ifstream file;
diff --git a/DRAMSys/simulator/src/simulation/StlPlayer.h b/DRAMSys/simulator/src/simulation/StlPlayer.h
index 92038aad..809a4da7 100644
--- a/DRAMSys/simulator/src/simulation/StlPlayer.h
+++ b/DRAMSys/simulator/src/simulation/StlPlayer.h
@@ -165,6 +165,18 @@ public:
}
+ unsigned int getNumberOfLines(string pathToTrace)
+ {
+ ifstream newFile;
+ newFile.open(pathToTrace);
+ newFile.unsetf(std::ios_base::skipws); // new lines will be skipped unless we stop it from happening:
+ // count the newlines with an algorithm specialized for counting:
+ unsigned int lineCount = std::count(std::istream_iterator(newFile), std::istream_iterator(), '\n');
+
+ newFile.close();
+ return lineCount;
+ }
+
private:
ifstream file;
diff --git a/DRAMSys/simulator/src/simulation/TracePlayer.h b/DRAMSys/simulator/src/simulation/TracePlayer.h
index 7a6d4523..6a8e90ef 100644
--- a/DRAMSys/simulator/src/simulation/TracePlayer.h
+++ b/DRAMSys/simulator/src/simulation/TracePlayer.h
@@ -51,6 +51,7 @@
#include "../common/dramExtension.h"
#include "../controller/core/TimingCalculation.h"
#include "TracePlayerListener.h"
+#include "Simulation.h"
using namespace std;
using namespace tlm;
@@ -96,7 +97,7 @@ gp *TracePlayer::allocatePayload()
template
void TracePlayer::terminate()
{
- cout << sc_time_stamp() << " " << this->name() << " terminated" << std::endl;
+ cout << sc_time_stamp() << " " << this->name() << " terminated " << std::endl;
listener->tracePlayerTerminates();
}
@@ -159,6 +160,9 @@ void TracePlayer::peqCallback(tlm_generic_payload &payload, const tlm_
sendToTarget(payload, END_RESP, SC_ZERO_TIME);
payload.release();
+ if(Configuration::getInstance().SimulationProgressBar)
+ listener->transactionFinished();
+
}
else if (phase == END_RESP)
{
diff --git a/DRAMSys/simulator/src/simulation/TracePlayerListener.h b/DRAMSys/simulator/src/simulation/TracePlayerListener.h
index 36a0cdd5..95c52773 100644
--- a/DRAMSys/simulator/src/simulation/TracePlayerListener.h
+++ b/DRAMSys/simulator/src/simulation/TracePlayerListener.h
@@ -42,6 +42,7 @@ class TracePlayerListener
{
public:
virtual void tracePlayerTerminates() = 0;
+ virtual void transactionFinished() = 0;
};
#endif // TRACEPLAYERLISTENER_H
diff --git a/README.md b/README.md
index 8e841423..1b7cec18 100644
--- a/README.md
+++ b/README.md
@@ -324,6 +324,7 @@ The DRAMSys' main configuration file is presented below.
+
@@ -423,6 +424,7 @@ The XML code below shows a typic configuration:
+
@@ -542,6 +544,10 @@ Below are listed the configuration sections and configuration fields.
- *ThermalSimulation* (boolean)
- "1": enables thermal simulation
- "0": static temperature during simulation
+ - *SimulationProgressBar* (boolean)
+ - "1": enables the simulation progress bar
+ - "0": disables the simulation progress bar
+
- **Temperature Simulator Configuration**
- *TemperatureScale* (string)