UT_Timer.cpp
Go to the documentation of this file.
00001 
00002 //
00003 // for class: UT_Timer
00004 //
00005 // Copyright (c) Frank Althof, August 2000
00006 // Lehrstuhl fuer Mensch-Maschine-Kommunikation
00007 // Technische Universitaet Muenchen
00008 // Arcisstrasse 21, D-80290 Muenchen
00009 //
00011 #ifndef WIN32
00012 /***************************   include   ************************************/
00013 
00014 #include "lo/UT_Timer.h"
00015 #include <iostream>
00016 #include <iomanip>
00017 
00018 /**************************   constructors   ********************************/
00019 
00020 UT_Timer::UT_Timer( void )
00021 {
00022   gettimeofday( &tv_start, NULL );
00023   gettimeofday( &tv_end, NULL );
00024 
00025   iClkTck = sysconf( _SC_CLK_TCK );
00026 }
00027 
00028 /*******************   destructor   *****************************************/
00029 
00030 /******************   other element functions   *****************************/
00031 
00032 double UT_Timer::end( char *message )
00033 {
00034   gettimeofday( &tv_end, NULL );
00035   usecs    = tv_end.tv_usec - tv_start.tv_usec;
00036   secs     = tv_end.tv_sec  - tv_start.tv_sec;
00037   ges_usecs = 1000000*secs  + usecs;
00038   if( message!=NULL )
00039     std::cerr << message << "  " << std::setw(10) << std::setfill(' ')
00040          << 0.001*ges_usecs << " ms";
00041   return  0.001*ges_usecs;
00042 }
00043 
00044 #endif
00045 
00046 /*********************   END OF FILE *********************************/


lo
Author(s): U. Klank
autogenerated on Mon Oct 6 2014 10:44:15