Included chrono clock for higher precision.
This commit is contained in:
@@ -39,7 +39,7 @@
|
||||
#include <systemc.h>
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
#include <ctime>
|
||||
#include <chrono>
|
||||
|
||||
#include "DRAMSys.h"
|
||||
#include "TraceSetup.h"
|
||||
@@ -53,6 +53,11 @@ string pathOfFile(string file)
|
||||
return file.substr(0, file.find_last_of('/'));
|
||||
}
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
return sc_main(argc, argv);
|
||||
}
|
||||
|
||||
int sc_main(int argc, char **argv)
|
||||
{
|
||||
sc_set_time_resolution(1, SC_PS);
|
||||
@@ -105,7 +110,7 @@ int sc_main(int argc, char **argv)
|
||||
}
|
||||
|
||||
// Store the starting of the simulation in wallclock time:
|
||||
clock_t simStartTime = clock();
|
||||
auto start = std::chrono::high_resolution_clock::now();
|
||||
|
||||
// Kickstart the players:
|
||||
for (auto &p : players) {
|
||||
@@ -116,8 +121,9 @@ int sc_main(int argc, char **argv)
|
||||
sc_set_stop_mode(SC_STOP_FINISH_DELTA);
|
||||
sc_start();
|
||||
|
||||
double elapsed_secs = double(clock() - simStartTime) / CLOCKS_PER_SEC;
|
||||
cout << "Simulation took " + to_string(elapsed_secs) + " seconds" << endl;
|
||||
auto finish = std::chrono::high_resolution_clock::now();
|
||||
std::chrono::duration<double> elapsed = finish - start;
|
||||
std::cout << "Simulation took " + std::to_string(elapsed.count()) + " seconds." << std::endl;
|
||||
|
||||
delete dramSys;
|
||||
delete ts;
|
||||
|
||||
Reference in New Issue
Block a user