16 #ifndef dealii_timer_h
17 #define dealii_timer_h
19 #include <deal.II/base/config.h>
21 #include <deal.II/base/conditional_ostream.h>
22 #include <deal.II/base/mpi.h>
23 #include <deal.II/base/thread_management.h>
24 #include <deal.II/base/utilities.h>
31 DEAL_II_NAMESPACE_OPEN
50 using rep = duration::rep;
60 using time_point = std::chrono::time_point<CPUClock, duration>;
141 Timer(MPI_Comm mpi_communicator,
const bool sync_lap_times =
false);
162 get_last_lap_wall_time_data()
const;
175 get_total_data()
const;
184 get_accumulated_wall_time_data()
const;
193 template <
class StreamType>
194 DEAL_II_DEPRECATED
void
195 print_data(StreamType &stream)
const;
201 template <
class StreamType>
203 print_last_lap_wall_time_data(StreamType &stream)
const;
212 template <
class StreamType>
213 DEAL_II_DEPRECATED
void
214 print_total_data(StreamType &stream)
const;
220 template <
class StreamType>
222 print_accumulated_wall_time_data(StreamType &stream)
const;
278 last_wall_time()
const;
296 last_cpu_time()
const;
305 get_lap_time()
const;
319 template <
class clock_type_>
691 cpu_and_wall_times_grouped
705 const OutputFrequency output_frequency,
706 const OutputType output_type);
719 const OutputFrequency output_frequency,
720 const OutputType output_type);
746 std::ostream & stream,
747 const OutputFrequency output_frequency,
748 const OutputType output_type);
775 const OutputFrequency output_frequency,
776 const OutputType output_type);
789 enter_subsection(
const std::string §ion_name);
795 enter_section(
const std::string §ion_name);
805 leave_subsection(
const std::string §ion_name =
"");
811 exit_section(
const std::string §ion_name =
"");
816 std::map<std::string, double>
817 get_summary_data(
const OutputData kind)
const;
824 print_summary()
const;
875 double total_cpu_time;
876 double total_wall_time;
877 unsigned int n_calls;
933 return last_lap_wall_time_data;
941 return last_lap_wall_time_data;
949 return accumulated_wall_time_data;
957 return accumulated_wall_time_data;
962 template <
class StreamType>
966 print_last_lap_wall_time_data(stream);
971 template <
class StreamType>
976 stream << statistic.
max <<
" wall,"
977 <<
" max @" << statistic.
max_index <<
", min=" << statistic.
min <<
" @"
978 << statistic.
min_index <<
", avg=" << statistic.
avg << std::endl;
983 template <
class StreamType>
987 print_accumulated_wall_time_data(stream);
992 template <
class StreamType>
997 stream << statistic.
max <<
" wall,"
998 <<
" max @" << statistic.
max_index <<
", min=" << statistic.
min <<
" @"
999 << statistic.
min_index <<
", avg=" << statistic.
avg << std::endl;
1007 enter_subsection(section_name);
1015 leave_subsection(section_name);
1019 const std::string & section_name_)
1021 , section_name(section_name_)
1036 timer.exit_section(section_name);
1040 DEAL_II_NAMESPACE_CLOSE