Skip to content

Commit

Permalink
Show progress in stdout
Browse files Browse the repository at this point in the history
  • Loading branch information
mdimura committed May 7, 2020
1 parent a22b13b commit 4f10840
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/gui/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ int main(int argc, char *argv[])
/*std::cout<<"std::thread::hardware_concurrency()="<<
std::thread::hardware_concurrency()<<std::endl;*/
pteros::Log::instance().logger->set_level(
spdlog::level::level_enum::warn);
spdlog::level::level_enum::err);
QApplication a(argc, argv);
a.setApplicationVersion(APP_VERSION);
QCommandLineParser parser;
Expand Down
13 changes: 10 additions & 3 deletions src/gui/mainwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -91,14 +91,21 @@ MainWindow::MainWindow(const QString json, const QString csvOut,
: 0;
tasksPendindOld = tasksPending;

const int tasksReady = trajectoriesModel.resultsCount();
int readyPct =
tasksReady * 100 / (tasksPending + tasksReady + 1);
QString message =
QString("v. #%1 | Tasks pending/ready/running: %2/%3/%4; ETA: %5")
QString("v. #%1 | Tasks pending/ready/running: %2/%3/%4; ETA: %5 %6%")
.arg(verHash)
.arg(tasksPending)
.arg(trajectoriesModel.resultsCount())
.arg(tasksReady)
.arg(trajectoriesModel.tasksRunningCount())
.arg(timespan(ETA));
.arg(timespan(ETA))
.arg(readyPct);
tasksStatus.setText(message);
message = message.leftJustified(74, ' ');
printf("\r%s", message.toStdString().c_str());
fflush(stdout);
ui->mainTreeView->viewport()->update();
});
timer->start(timerInterval);
Expand Down

0 comments on commit 4f10840

Please sign in to comment.