18 # pragma warning(disable:4786)
21 #if defined(__MACH__) || defined (__FreeBSD__)
24 #if !defined(__MSVCRT__)
25 #include <sys/resource.h>
33 #if 0 // change this to 1 if want to use the win32 API
40 #define TWO_TO_THE_THIRTYTWO 4294967296.0
41 #define DELTA_EPOCH_IN_SECS 11644473600.0
46 GetSystemTimeAsFileTime(&ft);
47 double t = ft.dwHighDateTime * TWO_TO_THE_THIRTYTWO + ft.dwLowDateTime;
48 t = t/10000000.0 - DELTA_EPOCH_IN_SECS;
52 #include <sys/types.h>
53 #include <sys/timeb.h>
56 struct _timeb timebuffer;
57 #pragma warning(disable:4996)
58 _ftime( &timebuffer );
59 #pragma warning(default:4996)
60 return timebuffer.time + timebuffer.millitm/1000.0;
71 gettimeofday(&tv, NULL);
72 return static_cast<double>(tv.tv_sec) + static_cast<int>(tv.tv_usec)/1000000.0;
88 static const double firstCall = callType > 0 ? callType : callTime;
89 return callType < 0 ? firstCall : callTime - firstCall;
102 #define TWO_TO_THE_THIRTYTWO 4294967296.0
108 #if defined(_MSC_VER) || defined(__MSVCRT__)
114 GetProcessTimes(GetCurrentProcess(), &creation, &exit, &kernel, &user);
115 double t = user.dwHighDateTime * TWO_TO_THE_THIRTYTWO + user.dwLowDateTime;
118 unsigned int ticksnow;
119 ticksnow = (
unsigned int)clock();
120 cpu_temp = (double)((
double)ticksnow/CLOCKS_PER_SEC);
126 usage.ru_utime.tv_sec = 0 ;
127 usage.ru_utime.tv_usec = 0 ;
129 getrusage(RUSAGE_SELF,&usage);
130 cpu_temp =
static_cast<double>(usage.ru_utime.tv_sec);
131 cpu_temp += 1.0e-6*(
static_cast<double> (usage.ru_utime.tv_usec));
143 #if defined(_MSC_VER) || defined(__MSVCRT__)
148 usage.ru_utime.tv_sec = 0 ;
149 usage.ru_utime.tv_usec = 0 ;
151 getrusage(RUSAGE_SELF,&usage);
152 sys_temp =
static_cast<double>(usage.ru_stime.tv_sec);
153 sys_temp += 1.0e-6*(
static_cast<double> (usage.ru_stime.tv_usec));
163 #if defined(_MSC_VER) || defined(__MSVCRT__)
168 usage.ru_utime.tv_sec = 0 ;
169 usage.ru_utime.tv_usec = 0 ;
171 getrusage(RUSAGE_CHILDREN,&usage);
172 cpu_temp =
static_cast<double>(usage.ru_utime.tv_sec);
173 cpu_temp += 1.0e-6*(
static_cast<double> (usage.ru_utime.tv_usec));
204 #ifdef COIN_COMPILE_WITH_TRACING
205 std::fstream* stream;
210 #ifdef COIN_COMPILE_WITH_TRACING
211 inline bool evaluate(
bool b_tmp)
const {
215 (*stream) << i_tmp <<
"\n";
221 inline double evaluate(
double d_tmp)
const {
224 (*stream) << d_tmp <<
"\n";
243 #ifdef COIN_COMPILE_WITH_TRACING
244 , stream(0), write_stream(true)
251 #ifdef COIN_COMPILE_WITH_TRACING
252 , stream(0), write_stream(true)
256 #ifdef COIN_COMPILE_WITH_TRACING
261 stream(s), write_stream(write) {}
265 CoinTimer(
double lim, std::fstream* s,
bool w) :
267 stream(s), write_stream(w) {}