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)
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
108 #ifdef COIN_DOING_DIFFS
113 #if defined(_MSC_VER) || defined(__MSVCRT__)
119 GetProcessTimes(GetCurrentProcess(), &creation, &exit, &kernel, &user);
120 double t = user.dwHighDateTime * TWO_TO_THE_THIRTYTWO + user.dwLowDateTime;
121 return t / 10000000.0;
123 unsigned int ticksnow;
124 ticksnow = (
unsigned int)clock();
125 cpu_temp = (double)((
double)ticksnow / CLOCKS_PER_SEC);
131 usage.ru_utime.tv_sec = 0;
132 usage.ru_utime.tv_usec = 0;
134 getrusage(RUSAGE_SELF, &usage);
135 cpu_temp =
static_cast< double >(usage.ru_utime.tv_sec);
136 cpu_temp += 1.0e-6 * (
static_cast< double >(usage.ru_utime.tv_usec));
146 #if defined(_MSC_VER) || defined(__MSVCRT__)
151 usage.ru_utime.tv_sec = 0;
152 usage.ru_utime.tv_usec = 0;
154 getrusage(RUSAGE_SELF, &usage);
155 sys_temp =
static_cast< double >(usage.ru_stime.tv_sec);
156 sys_temp += 1.0e-6 * (
static_cast< double >(usage.ru_stime.tv_usec));
166 #if defined(_MSC_VER) || defined(__MSVCRT__)
171 usage.ru_utime.tv_sec = 0;
172 usage.ru_utime.tv_usec = 0;
174 getrusage(RUSAGE_CHILDREN, &usage);
175 cpu_temp =
static_cast< double >(usage.ru_utime.tv_sec);
176 cpu_temp += 1.0e-6 * (
static_cast< double >(usage.ru_utime.tv_usec));
206 #ifdef COIN_COMPILE_WITH_TRACING
207 std::fstream *stream;
212 #ifdef COIN_COMPILE_WITH_TRACING
213 inline bool evaluate(
bool b_tmp)
const
218 (*stream) << i_tmp <<
"\n";
224 inline double evaluate(
double d_tmp)
const
228 (*stream) << d_tmp <<
"\n";
251 #ifdef COIN_COMPILE_WITH_TRACING
263 #ifdef COIN_COMPILE_WITH_TRACING
270 #ifdef COIN_COMPILE_WITH_TRACING
278 , write_stream(write)
284 CoinTimer(
double lim, std::fstream *s,
bool w)