00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef OPM_DEBUGTIMEREPORT_HEADER_INCLUDED
00021 #define OPM_DEBUGTIMEREPORT_HEADER_INCLUDED
00022
00023 #include <opm/common/OpmLog/OpmLog.hpp>
00024 #include <opm/core/utility/StopWatch.hpp>
00025 #include <string>
00026
00027 namespace Opm
00028 {
00029
00030 class DebugTimeReport
00031 {
00032 public:
00033 explicit DebugTimeReport(const std::string& report_name)
00034 : report_name_(report_name)
00035 {
00036 clock_.start();
00037 }
00038
00039 ~DebugTimeReport()
00040 {
00041 clock_.stop();
00042 std::ostringstream msg;
00043 msg << report_name_ << " took: " << clock_.secsSinceStart() << " seconds.";
00044 OpmLog::debug(msg.str());
00045 }
00046
00047 private:
00048 std::string report_name_;
00049 time::StopWatch clock_;
00050 };
00051
00052 }
00053
00054 #endif // OPM_DEBUGTIMEREPORT_HEADER_INCLUDED