From 60db2a2971b5a3aa9eb4622066d1f264d6b369da Mon Sep 17 00:00:00 2001 From: hieuhoang1972 Date: Fri, 1 Oct 2010 18:08:10 +0000 Subject: [PATCH] Time logging info git-svn-id: https://mosesdecoder.svn.sourceforge.net/svnroot/mosesdecoder/trunk@3601 1f5c12ca-751b-0410-a591-d2e778427230 --- moses-chart/src/ChartManager.cpp | 12 ++++++++++-- moses-chart/src/ChartManager.h | 3 ++- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/moses-chart/src/ChartManager.cpp b/moses-chart/src/ChartManager.cpp index ea9a29f6d..9048b46ce 100644 --- a/moses-chart/src/ChartManager.cpp +++ b/moses-chart/src/ChartManager.cpp @@ -43,8 +43,10 @@ namespace MosesChart Manager::Manager(InputType const& source, const TranslationSystem* system) :m_source(source) ,m_hypoStackColl(source, *this) - ,m_transOptColl(source, system, m_hypoStackColl), - m_system(system) +,m_transOptColl(source, system, m_hypoStackColl) +,m_system(system) +,m_start(clock()) + { m_system->InitializeBeforeSentenceProcessing(source); } @@ -52,6 +54,12 @@ Manager::Manager(InputType const& source, const TranslationSystem* system) Manager::~Manager() { m_system->CleanUpAfterSentenceProcessing(); + + clock_t end = clock(); + float et = (end - m_start); + et /= (float)CLOCKS_PER_SEC; + VERBOSE(1, "Translation took " << et << " seconds" << endl); + } void Manager::ProcessSentence() diff --git a/moses-chart/src/ChartManager.h b/moses-chart/src/ChartManager.h index 4cf87b642..58150713d 100644 --- a/moses-chart/src/ChartManager.h +++ b/moses-chart/src/ChartManager.h @@ -45,7 +45,8 @@ protected: TranslationOptionCollection m_transOptColl; /**< pre-computed list of translation options for the phrases in this sentence */ std::auto_ptr m_sentenceStats; const Moses::TranslationSystem* m_system; - + clock_t m_start; /**< starting time, used for logging */ + public: Manager(Moses::InputType const& source, const Moses::TranslationSystem* system); ~Manager();