19#include <kassert/kassert.hpp>
22#include "kamping/collectives/barrier.hpp"
23#include "kamping/collectives/gather.hpp"
24#include "kamping/communicator.hpp"
29namespace kamping::measurements {
121template <
typename CommunicatorType = Communicator<>>
203 _is_timer_enabled =
true;
207 _is_timer_enabled =
false;
221 template <
typename Pr
inter>
224 if (_comm.is_root()) {
233 bool _is_timer_enabled;
237 if (!_is_timer_enabled) {
241 node.is_active(
true);
246 node.startpoint(start_point);
256 LocalAggregationMode local_aggregation_mode, std::vector<GlobalAggregationMode>
const& global_aggregation_modes
258 if (!_is_timer_enabled) {
264 "There is no corresponding call to start() associated with this call to stop()",
268 auto startpoint = _timer_tree.
current_node->startpoint();
269 _timer_tree.
current_node->aggregate_measurements_locally(endpoint - startpoint, local_aggregation_mode);
270 if (!global_aggregation_modes.empty()) {
271 _timer_tree.
current_node->measurements_aggregation_operations() = global_aggregation_modes;
static double wtime()
Returns the elapsed time since an arbitrary time in the past.
Definition environment.hpp:158
STL-compatible allocator for requesting memory using the builtin MPI allocator.
Definition allocator.hpp:32
Distributed timer object.
Definition timer.hpp:122
void aggregate_and_print(Printer &&printer)
Aggregates and outputs the executed measurements. The output is done via the print() method of a give...
Definition timer.hpp:222
void stop_and_append(std::vector< GlobalAggregationMode > const &global_aggregation_modes=std::vector< GlobalAggregationMode >{})
Stops the currently active measurement and stores the result. If the key associated with the measurem...
Definition timer.hpp:177
void disable()
Disable start/stop operations, i.e., start()/stop() operations do not have any effect.
Definition timer.hpp:206
void start(std::string const &key)
Starts the measurement with the given key.
Definition timer.hpp:145
void clear()
Clears all stored measurements.
Definition timer.hpp:197
void enable()
(Re-)Enable start/stop operations.
Definition timer.hpp:202
Timer(CommunicatorType const &comm)
Constructs a timer using a given communicator.
Definition timer.hpp:131
void stop(std::vector< GlobalAggregationMode > const &global_aggregation_modes=std::vector< GlobalAggregationMode >{})
Stops the currently active measurement and stores the result.
Definition timer.hpp:157
Timer()
Constructs a timer using the MPI_COMM_WORLD communicator.
Definition timer.hpp:126
void stop_and_add(std::vector< GlobalAggregationMode > const &global_aggregation_modes=std::vector< GlobalAggregationMode >{})
Stops the currently active measurement and stores the result. If the key associated with the measurem...
Definition timer.hpp:166
void synchronize_and_start(std::string const &key)
Synchronizes all ranks in the underlying communicator via a barrier and then start the measurement wi...
Definition timer.hpp:137
double Duration
Definition timer.hpp:124
auto aggregate()
Evaluates the time measurements represented by the timer tree for which the current node is the root ...
Definition timer.hpp:191
Wrapper for MPI functions that don't require a communicator.
constexpr int light
Assertion level for lightweight assertions.
Definition assertion_levels.hpp:13
Tree consisting of objects of type NodeType. The tree constitutes a hierarchy of measurements such th...
Definition measurement_utils.hpp:278
NodeType * current_node
Pointer to the currently active node of the tree.
Definition measurement_utils.hpp:289
Timer< Communicator<> > & timer()
Gets a reference to a kamping::measurements::BasicTimer.
Definition timer.hpp:280