Commit 46f5d887 authored by Praetorius, Simon's avatar Praetorius, Simon

Timer added

parent 4527983f
......@@ -7,6 +7,7 @@ install(FILES
Request.hpp
RequestOperations.hpp
Serialization.hpp
Time.hpp
Type_Traits.hpp
mpi14.hpp
DESTINATION include/mpi14/
......
#pragma once
namespace mpi14
{
/// Return the current (wall-clock) time in seconds (w.r.t. fixed time in the past)
inline double now()
{
return MPI_Wtime();
}
/// Time measurement
class Timer
{
public:
/// initializes the timer with current time
Timer()
: time0(now())
{}
/// resets the timer to current time
void reset()
{
time0 = now();
}
/// returns the elapsed time (from construction or last reset) to now in seconds
double elapsed() const
{
return now() - time0;
}
private:
/// begin value for parallel measurement
double time0;
};
} // end namespace mpi14
......@@ -7,3 +7,4 @@
#include "RequestOperations.hpp"
#include "Collective.hpp"
#include "Time.hpp"
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment