19 # pragma warning(disable:4786)
22 #if defined(__MACH__) || defined (__FreeBSD__)
25 #if !defined(__MSVCRT__)
26 #include <sys/resource.h>
34 #if 0 // change this to 1 if want to use the win32 API
41 #define TWO_TO_THE_THIRTYTWO 4294967296.0
42 #define DELTA_EPOCH_IN_SECS 11644473600.0
47 GetSystemTimeAsFileTime(&ft);
48 double t = ft.dwHighDateTime * TWO_TO_THE_THIRTYTWO + ft.dwLowDateTime;
49 t = t/10000000.0 - DELTA_EPOCH_IN_SECS;
53 #include <sys/types.h>
54 #include <sys/timeb.h>
57 struct _timeb timebuffer;
58 #pragma warning(disable:4996)
59 _ftime( &timebuffer );
60 #pragma warning(default:4996)
61 return timebuffer.time + timebuffer.millitm/1000.0;
72 gettimeofday(&tv, NULL);
73 return static_cast<double>(tv.tv_sec) + static_cast<int>(tv.tv_usec)/1000000.0;
89 static const double firstCall = callType > 0 ? callType : callTime;
90 return callType < 0 ? firstCall : callTime - firstCall;
103 #define TWO_TO_THE_THIRTYTWO 4294967296.0
109 #if defined(_MSC_VER) || defined(__MSVCRT__)
115 GetProcessTimes(GetCurrentProcess(), &creation, &exit, &kernel, &user);
116 double t = user.dwHighDateTime * TWO_TO_THE_THIRTYTWO + user.dwLowDateTime;
119 unsigned int ticksnow;
120 ticksnow = (
unsigned int)clock();
121 cpu_temp = (double)((
double)ticksnow/CLOCKS_PER_SEC);
127 usage.ru_utime.tv_sec = 0 ;
128 usage.ru_utime.tv_usec = 0 ;
130 getrusage(RUSAGE_SELF,&usage);
131 cpu_temp =
static_cast<double>(usage.ru_utime.tv_sec);
132 cpu_temp += 1.0e-6*(
static_cast<double> (usage.ru_utime.tv_usec));
144 #if defined(_MSC_VER) || defined(__MSVCRT__)
149 usage.ru_utime.tv_sec = 0 ;
150 usage.ru_utime.tv_usec = 0 ;
152 getrusage(RUSAGE_SELF,&usage);
153 sys_temp =
static_cast<double>(usage.ru_stime.tv_sec);
154 sys_temp += 1.0e-6*(
static_cast<double> (usage.ru_stime.tv_usec));
164 #if defined(_MSC_VER) || defined(__MSVCRT__)
169 usage.ru_utime.tv_sec = 0 ;
170 usage.ru_utime.tv_usec = 0 ;
172 getrusage(RUSAGE_CHILDREN,&usage);
173 cpu_temp =
static_cast<double>(usage.ru_utime.tv_sec);
174 cpu_temp += 1.0e-6*(
static_cast<double> (usage.ru_utime.tv_usec));
205 #ifdef COIN_COMPILE_WITH_TRACING
206 std::fstream* stream;
211 #ifdef COIN_COMPILE_WITH_TRACING
212 inline bool evaluate(
bool b_tmp)
const {
216 (*stream) << i_tmp <<
"\n";
222 inline double evaluate(
double d_tmp)
const {
225 (*stream) << d_tmp <<
"\n";
244 #ifdef COIN_COMPILE_WITH_TRACING
245 , stream(0), write_stream(true)
252 #ifdef COIN_COMPILE_WITH_TRACING
253 , stream(0), write_stream(true)
257 #ifdef COIN_COMPILE_WITH_TRACING
262 stream(s), write_stream(write) {}
266 CoinTimer(
double lim, std::fstream* s,
bool w) :
268 stream(s), write_stream(w) {}