more performance metrics output
This commit is contained in:
parent
1d1b6de616
commit
b3b00ac7f3
|
@ -86,6 +86,7 @@ void process_arguments(int argc, char *argv[]) {
|
||||||
|
|
||||||
log = Log::getInstance();
|
log = Log::getInstance();
|
||||||
log->setLogLevel(Log::ERROR);
|
log->setLogLevel(Log::ERROR);
|
||||||
|
|
||||||
while ((c = getopt(argc, argv, "D:f:?")) != -1) {
|
while ((c = getopt(argc, argv, "D:f:?")) != -1) {
|
||||||
switch (c) {
|
switch (c) {
|
||||||
case 'D':
|
case 'D':
|
||||||
|
@ -129,6 +130,8 @@ void process_arguments(int argc, char *argv[]) {
|
||||||
|
|
||||||
int sc_main(int argc, char *argv[]) {
|
int sc_main(int argc, char *argv[]) {
|
||||||
|
|
||||||
|
Performance *perf = Performance::getInstance();
|
||||||
|
|
||||||
/* Capture Ctrl+C and finish the simulation */
|
/* Capture Ctrl+C and finish the simulation */
|
||||||
signal(SIGINT, intHandler);
|
signal(SIGINT, intHandler);
|
||||||
|
|
||||||
|
@ -142,10 +145,13 @@ int sc_main(int argc, char *argv[]) {
|
||||||
|
|
||||||
auto start = std::chrono::steady_clock::now();
|
auto start = std::chrono::steady_clock::now();
|
||||||
sc_core::sc_start();
|
sc_core::sc_start();
|
||||||
|
|
||||||
auto end = std::chrono::steady_clock::now();
|
auto end = std::chrono::steady_clock::now();
|
||||||
|
|
||||||
std::chrono::duration<double> elapsed_seconds = end - start;
|
std::chrono::duration<double> elapsed_seconds = end - start;
|
||||||
|
double instructions = perf->getInstructions() / elapsed_seconds.count();
|
||||||
|
|
||||||
std::cout << "Total elapsed time: " << elapsed_seconds.count() << "s" << std::endl;
|
std::cout << "Total elapsed time: " << elapsed_seconds.count() << "s" << std::endl;
|
||||||
|
std::cout << "Simulated " << int(std::round(instructions)) << " instr/sec" << std::endl;
|
||||||
std::cout << "Press Enter to finish" << std::endl;
|
std::cout << "Press Enter to finish" << std::endl;
|
||||||
std::cin.ignore();
|
std::cin.ignore();
|
||||||
|
|
||||||
|
|
|
@ -22,7 +22,7 @@ void extension_base::setInstr(uint32_t p_instr) {
|
||||||
m_instr = sc_dt::sc_uint<32>(p_instr);
|
m_instr = sc_dt::sc_uint<32>(p_instr);
|
||||||
}
|
}
|
||||||
|
|
||||||
void extension_base::dump() {
|
void extension_base::dump() const {
|
||||||
std::cout << std::hex << "0x" << m_instr << std::dec << std::endl;
|
std::cout << std::hex << "0x" << m_instr << std::dec << std::endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue