16 #ifndef dealii_timer_h 17 #define dealii_timer_h 19 #include <deal.II/base/config.h> 20 #include <deal.II/base/conditional_ostream.h> 21 #include <deal.II/base/mpi.h> 22 #include <deal.II/base/thread_management.h> 23 #include <deal.II/base/utilities.h> 30 DEAL_II_NAMESPACE_OPEN
49 typedef duration::rep
rep;
59 typedef std::chrono::time_point<CPUClock, duration>
time_point;
139 Timer (MPI_Comm mpi_communicator,
140 const bool sync_lap_times =
false);
188 template <
class StreamType>
190 void print_data(StreamType &stream)
const;
196 template <
class StreamType>
197 void print_last_lap_wall_time_data(StreamType &stream)
const;
206 template <
class StreamType>
208 void print_total_data(StreamType &stream)
const;
214 template <
class StreamType>
215 void print_accumulated_wall_time_data(StreamType &stream)
const;
252 double operator() ()
const;
258 double wall_time ()
const;
264 double last_wall_time()
const;
274 double cpu_time()
const;
280 double last_cpu_time()
const;
288 double get_lap_time ()
const;
302 template <
class clock_type_>
682 const OutputFrequency output_frequency,
683 const OutputType output_type);
696 const OutputFrequency output_frequency,
697 const OutputType output_type);
723 std::ostream &stream,
724 const OutputFrequency output_frequency,
725 const OutputType output_type);
752 const OutputFrequency output_frequency,
753 const OutputType output_type);
765 void enter_subsection (
const std::string §ion_name);
770 void enter_section (
const std::string §ion_name);
778 void leave_subsection (
const std::string §ion_name = std::string());
783 void exit_section (
const std::string §ion_name = std::string());
788 std::map<std::string, double> get_summary_data (
const OutputData kind)
const;
794 void print_summary ()
const;
802 void disable_output ();
810 void enable_output ();
842 double total_cpu_time;
843 double total_wall_time;
844 unsigned int n_calls;
901 return last_lap_wall_time_data;
910 return last_lap_wall_time_data;
919 return accumulated_wall_time_data;
928 return accumulated_wall_time_data;
933 template <
class StreamType>
938 print_last_lap_wall_time_data(stream);
943 template <
class StreamType>
949 stream << statistic.
max <<
" wall," 950 <<
" max @" << statistic.
max_index <<
", min=" << statistic.
min <<
" @" 951 << statistic.
min_index <<
", avg=" << statistic.
avg << std::endl;
956 template <
class StreamType>
961 print_accumulated_wall_time_data(stream);
966 template <
class StreamType>
972 stream << statistic.
max <<
" wall," 973 <<
" max @" << statistic.
max_index <<
", min=" << statistic.
min <<
" @" 974 << statistic.
min_index <<
", avg=" << statistic.
avg << std::endl;
983 enter_subsection(section_name);
992 leave_subsection(section_name);
997 const std::string §ion_name_)
1000 section_name(section_name_),
1015 timer.exit_section(section_name);
1019 DEAL_II_NAMESPACE_CLOSE
const Utilities::MPI::MinMaxAvg & get_data() const
std::chrono::steady_clock wall_clock_type
void print_accumulated_wall_time_data(StreamType &stream) const
MPI_Comm mpi_communicator
MPI_Comm mpi_communicator
static time_point now() noexcept
clock_type::duration duration_type
std::chrono::microseconds duration
void enter_section(const std::string §ion_name)
void exit_section(const std::string §ion_name=std::string())
clock_type::time_point time_point_type
Utilities::MPI::MinMaxAvg last_lap_wall_time_data
void print_last_lap_wall_time_data(StreamType &stream) const
const std::string section_name
duration_type accumulated_time
std::chrono::time_point< CPUClock, duration > time_point
ClockMeasurements< wall_clock_type > wall_times
const Utilities::MPI::MinMaxAvg & get_last_lap_wall_time_data() const
duration_type last_lap_time
std::list< std::string > active_sections
static const bool is_steady
void print_total_data(StreamType &stream) const
const Utilities::MPI::MinMaxAvg & get_accumulated_wall_time_data() const
std::map< std::string, Section > sections
ConditionalOStream out_stream
void print_data(StreamType &stream) const
OutputFrequency output_frequency
time_point_type current_lap_start_time
Utilities::MPI::MinMaxAvg accumulated_wall_time_data
const Utilities::MPI::MinMaxAvg & get_total_data() const
Scope(::TimerOutput &timer_, const std::string §ion_name)
ClockMeasurements< cpu_clock_type > cpu_times