Improve displayed rendering time by including compilation time

master
Marius Kintel 2014-12-16 18:01:25 -05:00
parent 0448b0f1db
commit 3d0749b619
2 changed files with 8 additions and 6 deletions

View File

@ -14,6 +14,7 @@
#include <vector>
#include <QMutex>
#include <QSet>
#include <QTime>
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

View File

@ -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<const Geometry> 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()) {