diff --git a/Modules/Wrappers/ApplicationEngine/include/otbWrapperApplication.h b/Modules/Wrappers/ApplicationEngine/include/otbWrapperApplication.h index e534fabc63361dac54accd9ea8337fedb5325326..a06fa56e192ba15ca13f2027a64ad544d439f370 100644 --- a/Modules/Wrappers/ApplicationEngine/include/otbWrapperApplication.h +++ b/Modules/Wrappers/ApplicationEngine/include/otbWrapperApplication.h @@ -24,6 +24,7 @@ #include "otbWrapperParameterGroup.h" #include "itkLogger.h" +#include "itkTimeProbe.h" #include "otbWrapperMacros.h" #include "otbWrapperInputImageParameter.h" #include "otbWrapperInputImageListParameter.h" @@ -737,6 +738,8 @@ public: m_IsInXMLParsed = false; } + double GetLastExecutionTiming() const; + protected: /** Constructor */ Application(); @@ -898,6 +901,9 @@ private: /** Tags that define the application (ex : segmentation, OBIA).*/ std::vector<std::string> m_DocTags; + /** Chrono to measure execution time */ + itk::TimeProbe m_Chrono; + //rashad:: controls adding of -xml parameter. set to true by default bool m_HaveInXML; bool m_HaveOutXML; diff --git a/Modules/Wrappers/ApplicationEngine/src/otbWrapperApplication.cxx b/Modules/Wrappers/ApplicationEngine/src/otbWrapperApplication.cxx index b1f07148aa55ca4f906f8bca5100e03077455570..ae7cbd1d87ff860e76d3f7fa07ca1ad32ecd6fa5 100644 --- a/Modules/Wrappers/ApplicationEngine/src/otbWrapperApplication.cxx +++ b/Modules/Wrappers/ApplicationEngine/src/otbWrapperApplication.cxx @@ -228,6 +228,9 @@ int Application::Execute() int Application::ExecuteAndWriteOutput() { + m_Chrono.Reset(); + m_Chrono.Start(); + int status = this->Execute(); if (status == 0) @@ -335,6 +338,7 @@ int Application::ExecuteAndWriteOutput() this->AfterExecuteAndWriteOutputs(); + m_Chrono.Stop(); return status; } @@ -1632,5 +1636,10 @@ std::string Application::GetProgressDescription() const return m_ProgressSourceDescription; } +double Application::GetLastExecutionTiming() const +{ + return m_Chrono.GetTotal(); +} + } } diff --git a/Modules/Wrappers/QtWidget/src/otbWrapperQtWidgetModel.cxx b/Modules/Wrappers/QtWidget/src/otbWrapperQtWidgetModel.cxx index aea3f7ae3c27dadca9181b212c2a830d0a984598..beba06a405edcc7a9bc18399b18c7989923e3d4e 100644 --- a/Modules/Wrappers/QtWidget/src/otbWrapperQtWidgetModel.cxx +++ b/Modules/Wrappers/QtWidget/src/otbWrapperQtWidgetModel.cxx @@ -99,10 +99,10 @@ QtWidgetModel SLOT( OnApplicationExecutionDone( int ) ) ); - taskAppli->Execute(); - // Tell the Progress Reporter to begin emit SetProgressReportBegin(); + + taskAppli->Execute(); } void @@ -113,6 +113,13 @@ QtWidgetModel // and the GUI to update message emit SetProgressReportDone( status ); + if (status >= 0) + { + std::ostringstream oss; + oss << "Execution took "<< m_Application->GetLastExecutionTiming() << " sec"; + SendLogINFO(oss.str()); + } + // start timer m_Timer->start(); }