diff --git a/hurricane/src/hurricane/Timer.cpp b/hurricane/src/hurricane/Timer.cpp index 4fdf66d9..00deb4ac 100644 --- a/hurricane/src/hurricane/Timer.cpp +++ b/hurricane/src/hurricane/Timer.cpp @@ -143,11 +143,11 @@ namespace Hurricane { } - std::ostream& operator<<(std::ostream& os, const Timer& tm) + string Timer::_getString () const { //CPUNormalizer cpunorm; - double userSec = tm.getUserTime (); - double normSec = tm.getUserTime (); // * cpunorm.getNormalizingFactor(); + double userSec = getUserTime (); + double normSec = getUserTime (); // * cpunorm.getNormalizingFactor(); char buffer[20]; if ( userSec > 0.01 ) { @@ -160,15 +160,16 @@ namespace Hurricane { normSec -= delta; } - sprintf ( buffer, "%.1e", tm.getSysTime() ); + sprintf ( buffer, "%.1e", getSysTime() ); - os << " " << userSec << " user," - << " " << buffer << " system," - << " " << tm.getRealTime() << " real," - << " " << normSec << " norm'd " + ostringstream os; + os << " " << userSec << " user," + << " " << buffer << " system," + << " " << getRealTime() << " real," + << " " << normSec << " norm'd " << "sec "; - return os; + return os.str(); } diff --git a/hurricane/src/hurricane/hurricane/Timer.h b/hurricane/src/hurricane/hurricane/Timer.h index 25140008..c21139fb 100644 --- a/hurricane/src/hurricane/hurricane/Timer.h +++ b/hurricane/src/hurricane/hurricane/Timer.h @@ -100,8 +100,7 @@ namespace Hurricane { inline size_t getMemorySize () const; inline size_t getIncrease () const; inline void resetIncrease (); - // Friends Functions. - friend std::ostream& operator<< ( std::ostream& os, const Timer& tm ); + string _getString () const; protected: // Internal: Enum. @@ -183,4 +182,7 @@ namespace Hurricane { } // End of Hurricane namespace. +IOSTREAM_VALUE_SUPPORT(Hurricane::Timer); + + #endif // __HURRICANE_TIMER__