Add timed status output in verbose mode in CLI
MODIFY
src/cli/clioptions.h
src/cli/clioptions.h
@@ -13,10 +13,10 @@ struct CLIModeOptions {
SourceType srcType;
ProcessorID proc;
QStringList isaExtensions;
- bool verbose;
- QString outputFile;
- bool jsonOutput;
- int timeout;
+ bool verbose = false;
+ QString outputFile = "";
+ bool jsonOutput = false;
+ int timeout = 0;
// A list of enabled telemetry options.
std::vector<std::shared_ptr<Telemetry>> telemetry;

MODIFY
src/cli/clirunner.cpp
src/cli/clirunner.cpp
@@ -116,11 +116,36 @@ int CLIRunner::runModel() {
QObject::connect(&timeoutTimer, &QTimer::timeout, &loop,
[&]() { hadTimeout = true; });
+ // Display status info every second when verbose output is enabled.
+ QTimer infoTimer;
+ QElapsedTimer elapsed;
+ elapsed.start();
+ infoTimer.connect(&infoTimer, &QTimer::timeout, this, [&]() {
+ QTime timeFormat(0, 0);
+ QString infostr =
+ timeFormat.addMSecs(elapsed.elapsed()).toString("hh:mm:ss");
+ const auto cycleCount = ProcessorHandler::getProcessor()->getCycleCount();
+ const auto instrsRetired =
+ ProcessorHandler::getProcessor()->getInstructionsRetired();
+ infostr += "\tcycles: " + QString::number(cycleCount);
+ infostr += "\tretired: " + QString::number(instrsRetired);
+ info(infostr, false, false);
+ });
+
+ if (m_options.verbose)
+ infoTimer.start(1000);
+
+ // Start simulation
ProcessorHandler::run();
if (m_options.timeout != 0)
timeoutTimer.start(m_options.timeout);
loop.exec();
+ // Event loop finished either by processor finishing or timeout. Determine the
+ // cause and act.
+
+ timeoutTimer.stop();
+ infoTimer.stop();
if (hadTimeout) {
ProcessorHandler::stopRun();
error("Simulation did not finish within the specified timeout (" +

Add timed status output in verbose mode in CLI