last-svn-commit-926-g905cb97 Add a timer in content_in_doc [to cleanup]

--- .../toolchain/internal/content_in_doc_functor.hh | 50 +++++++++++++++++++- 1 files changed, 49 insertions(+), 1 deletions(-) diff --git a/scribo/scribo/toolchain/internal/content_in_doc_functor.hh b/scribo/scribo/toolchain/internal/content_in_doc_functor.hh index dde8196..705cf4d 100644 --- a/scribo/scribo/toolchain/internal/content_in_doc_functor.hh +++ b/scribo/scribo/toolchain/internal/content_in_doc_functor.hh @@ -27,6 +27,10 @@ #ifndef SCRIBO_TOOLCHAIN_INTERNAL_CONTENT_IN_DOC_FUNCTOR_HH # define SCRIBO_TOOLCHAIN_INTERNAL_CONTENT_IN_DOC_FUNCTOR_HH +# ifndef SCRIBO_NDEBUG +# include <mln/util/timer.hh> +# endif // ! SCRIBO_NDEBUG + # include <scribo/core/def/lbl_type.hh> # include <scribo/core/document.hh> # include <scribo/core/line_set.hh> @@ -132,6 +136,19 @@ namespace scribo // Results //========= document<L> doc; + +# ifndef SCRIBO_NDEBUG + //============= + // DEBUG TOOLS + //============= + virtual void on_start(); + virtual void on_end(); + virtual void on_progress(); + + mln::util::timer t; + mln::util::timer gt; +# endif // ! SCRIBO_NDEBUG + }; @@ -594,8 +611,39 @@ namespace scribo // Nothing } -# endif // ! MLN_INCLUDE_ONLY +# ifndef SCRIBO_NDEBUG + + template <typename I> + void + content_in_doc_functor<I>::on_start() + { + gt.start(); + t.start(); + } + template <typename I> + void + content_in_doc_functor<I>::on_end() + { + gt.stop(); + if (verbose) + std::cout << "Total time: " << gt << std::endl; + } + + template <typename I> + void + content_in_doc_functor<I>::on_progress() + { + t.stop(); + if (verbose) + std::cout << t << std::endl; + t.restart(); + } + + +# endif // ! SCRIBO_NDEBUG + +# endif // ! MLN_INCLUDE_ONLY } // end of namespace scribo::toolchain::internal -- 1.5.6.5
participants (1)
-
Guillaume Lazzara