diff --git a/src/core/timing/Timer.h b/src/core/timing/Timer.h index 86814b043ec8ae7b05d9c8d3027db477a1fb1336..d3c72dfe05fc095791f0ee4b8b1a65c4126c9a60 100644 --- a/src/core/timing/Timer.h +++ b/src/core/timing/Timer.h @@ -28,6 +28,8 @@ #include "WcPolicy.h" #include "core/DataTypes.h" +#include <iomanip> +#include <iostream> #include <limits> @@ -442,6 +444,24 @@ inline void Timer<TP>::merge( const Timer<TP> & other ) //********************************************************************************************************************** +//====================================================================================================================== +// +// OSTREAM OVERLOAD +// +//====================================================================================================================== + +template< typename TP > // Timing policy +std::ostream & operator<< ( std::ostream & os, const Timer<TP> & timer ) +{ + os << std::fixed << std::setprecision(3) << + "average: " << timer.average() << + " | min: " << timer.min() << + " | max: " << timer.max() << + " | variance: " << timer.variance(); + return os; +} + + } // namespace timing typedef timing::Timer<timing::CpuPolicy> CpuTimer;