diff --git a/stuff/misc.hh b/stuff/misc.hh index 6d6bf202ac82dfd1812187e9568a82789cd59e76..567975610a79cfa5737bd08640f8c4715f635a6c 100644 --- a/stuff/misc.hh +++ b/stuff/misc.hh @@ -106,11 +106,11 @@ public: } void putErrorCol(std::ofstream& outputFile_, const double prevError_, const double error_, const double prevh_, - const bool initial) + const bool /*initial*/) { current_h_ = info_.grid_width; - double factor = prevh_ / current_h_; - double eoc = std::log(prevError_ / error_) / log(factor); + double factor = current_h_ / prevh_; + double eoc = std::log(error_ / prevError_) / std::log(factor); outputFile_ << " & " << error_ << " & " << eoc; } @@ -142,8 +142,8 @@ public: void putStaticCols(std::ofstream& outputFile_) { - outputFile_ << std::setw(4) << info_.grid_width << " & " << info_.codim0 << " & " << info_.c11 << " & " << info_.d11 - << " & " << info_.c12 << " & " << info_.d12; + outputFile_ << std::setw(4) << info_.grid_width << " & " << info_.codim0 << " & " << info_.run_time << " & " + << info_.c11 << " & " << info_.d11 << " & " << info_.c12 << " & " << info_.d12; } void endTable(std::ofstream& outputFile_) diff --git a/stuff/profiler.hh b/stuff/profiler.hh index b7acda385d9f7c028d170d4efd314d724eb86260..88b25235d257376e1ecd5f871544a16be59f92b0 100644 --- a/stuff/profiler.hh +++ b/stuff/profiler.hh @@ -56,6 +56,12 @@ public: (m_timings[m_cur_run_num])[section_name].end = clock(); } + inline long GetTiming(const std::string section_name) + { + clock_t diff = (m_timings[m_cur_run_num])[section_name].end - (m_timings[m_cur_run_num])[section_name].start; + return long(diff / double(CLOCKS_PER_SEC)); + } + /** output to currently pre-defined (csv) file * \param comm used to gather and average the runtime data over all processes * \tparam CollectiveCommunication should be Dune::CollectiveCommunication< MPI_Comm / double >