Skip to content
Snippets Groups Projects
Commit 71a7b79f authored by Sebastian Eibl's avatar Sebastian Eibl
Browse files

added stream output to Timer

parent e1bfd140
Branches
Tags
No related merge requests found
...@@ -28,6 +28,8 @@ ...@@ -28,6 +28,8 @@
#include "WcPolicy.h" #include "WcPolicy.h"
#include "core/DataTypes.h" #include "core/DataTypes.h"
#include <iomanip>
#include <iostream>
#include <limits> #include <limits>
...@@ -442,6 +444,24 @@ inline void Timer<TP>::merge( const Timer<TP> & other ) ...@@ -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 } // namespace timing
typedef timing::Timer<timing::CpuPolicy> CpuTimer; typedef timing::Timer<timing::CpuPolicy> CpuTimer;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment