From 3d0749b61939ccefa2d01dad07206992b96e81e5 Mon Sep 17 00:00:00 2001 From: Marius Kintel Date: Tue, 16 Dec 2014 18:01:25 -0500 Subject: [PATCH] Improve displayed rendering time by including compilation time --- src/MainWindow.h | 3 +++ src/mainwin.cc | 11 +++++------ 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/src/MainWindow.h b/src/MainWindow.h index edf595c2..5d415734 100644 --- a/src/MainWindow.h +++ b/src/MainWindow.h @@ -14,6 +14,7 @@ #include #include #include +#include enum export_type_e { EXPORT_TYPE_UNKNOWN, @@ -40,6 +41,8 @@ public: std::string autoReloadId; QTimer *waitAfterReloadTimer; + QTime renderingTime; + ModuleContext top_ctx; FileModule *root_module; // Result of parsing ModuleInstantiation root_inst; // Top level instance diff --git a/src/mainwin.cc b/src/mainwin.cc index 73071ad0..2c46b4db 100644 --- a/src/mainwin.cc +++ b/src/mainwin.cc @@ -862,6 +862,8 @@ void MainWindow::compile(bool reload, bool forcedone) bool shouldcompiletoplevel = false; bool didcompile = false; + this->renderingTime.start(); + // Reload checks the timestamp of the toplevel file and refreshes if necessary, if (reload) { // Refresh files if it has changed on disk @@ -1035,9 +1037,6 @@ void MainWindow::compileCSG(bool procevents) if (procevents) QApplication::processEvents(); // Main CSG evaluation - QTime t; - t.start(); - this->progresswidget = new ProgressWidget(this); connect(this->progresswidget, SIGNAL(requestShow()), this, SLOT(showProgress())); @@ -1123,8 +1122,8 @@ void MainWindow::compileCSG(bool procevents) this->thrownTogetherRenderer = new ThrownTogetherRenderer(this->root_chain, this->highlights_chain, this->background_chain); - PRINT("CSG generation finished."); - int s = t.elapsed() / 1000; + PRINT("Compile and preview finished."); + int s = this->renderingTime.elapsed() / 1000; PRINTB("Total rendering time: %d hours, %d minutes, %d seconds", (s / (60*60)) % ((s / 60) % 60) % (s % 60)); if (procevents) QApplication::processEvents(); } @@ -1762,7 +1761,7 @@ void MainWindow::actionRenderDone(shared_ptr root_geom) CGALCache::instance()->print(); #endif - int s = this->progresswidget->elapsedTime() / 1000; + int s = this->renderingTime.elapsed() / 1000; PRINTB("Total rendering time: %d hours, %d minutes, %d seconds", (s / (60*60)) % ((s / 60) % 60) % (s % 60)); if (root_geom && !root_geom->isEmpty()) {