From 22dba2cb272b60da6383a31f01db03e92837deae Mon Sep 17 00:00:00 2001 From: Michael Mandl Date: Mon, 26 Oct 2015 09:19:48 +0100 Subject: [PATCH] Added time measurement --- gui/NeuroUI/netlearner.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/gui/NeuroUI/netlearner.cpp b/gui/NeuroUI/netlearner.cpp index 4c68822..4db9939 100644 --- a/gui/NeuroUI/netlearner.cpp +++ b/gui/NeuroUI/netlearner.cpp @@ -1,10 +1,14 @@ #include "netlearner.h" #include "../../Net.h" +#include + void NetLearner::run() { try { + QElapsedTimer timer; + Net myNet({2, 3, 1}); size_t batchSize = 5000; @@ -12,6 +16,8 @@ void NetLearner::run() double batchMaxError = 0.0; double batchMeanError = 0.0; + timer.start(); + size_t numIterations = 1000000; for (size_t iteration = 0; iteration < numIterations; ++iteration) { @@ -59,6 +65,13 @@ void NetLearner::run() emit progress((double)iteration / (double)numIterations); } + QString timerLogString; + timerLogString.append("Elapsed time: "); + timerLogString.append(QString::number(timer.elapsed() / 1000.0)); + timerLogString.append(" seconds"); + + emit logMessage(timerLogString); + myNet.save("mynet.nnet"); } catch (std::exception &ex)