34#if defined(_WIN32) || defined(_WIN64)
57 clock_t clocks_per_second;
59#if defined(_WIN32) || defined(_WIN64)
60 clocks_per_second = 100;
63 clocks_per_second = sysconf(_SC_CLK_TCK);
65 clocks_per_second = CLK_TCK;
69 return (SCIP_Real)cputime / (
SCIP_Real)clocks_per_second;
82 return (SCIP_Real)sec + 0.000001 * (
SCIP_Real)usec;
92 clock_t clocks_per_second;
96#if defined(_WIN32) || defined(_WIN64)
97 clocks_per_second = 100;
100 clocks_per_second = sysconf(_SC_CLK_TCK);
102 clocks_per_second = CLK_TCK;
105 *cputime = (clock_t)(sec * clocks_per_second);
119 *wallsec = (long)sec;
120 *wallusec = (long)((sec - *wallsec) * 1000000.0);
202 SCIPdebugMessage(
"initializing clock %p of type %d\n", (
void*)clck, clocktype);
281 SCIPdebugMessage(
"setting type of clock %p (type %d, usedefault=%u) to %d\n",
302 if( clck->
nruns == 0 )
304#if defined(_WIN32) || defined(_WIN64)
305 FILETIME creationtime;
316 switch( clck->clocktype )
319#if defined(_WIN32) || defined(_WIN64)
320 GetProcessTimes(GetCurrentProcess(), &creationtime, &exittime, &kerneltime, &usertime);
321 clck->data.cpuclock.user -= usertime.dwHighDateTime * 42950 + usertime.dwLowDateTime / 100000L;
324 clck->data.cpuclock.user -= now.tms_utime;
326 clck->lasttime =
cputime2sec(clck->data.cpuclock.user);
330#if defined(_WIN32) || defined(_WIN64)
331 clck->data.wallclock.sec -= time(
NULL);
333 gettimeofday(&tp,
NULL);
334 if( tp.tv_usec > clck->data.wallclock.usec )
336 clck->data.wallclock.sec -= (tp.tv_sec + 1);
337 clck->data.wallclock.usec += (1000000 - tp.tv_usec);
341 clck->data.wallclock.sec -= tp.tv_sec;
342 clck->data.wallclock.usec -= tp.tv_usec;
345 clck->lasttime =
walltime2sec(clck->data.wallclock.sec, clck->data.wallclock.usec);
373 if( clck->
nruns == 0 )
375#if defined(_WIN32) || defined(_WIN64)
376 FILETIME creationtime;
387 switch( clck->clocktype )
390#if defined(_WIN32) || defined(_WIN64)
391 GetProcessTimes(GetCurrentProcess(), &creationtime, &exittime, &kerneltime, &usertime);
392 clck->data.cpuclock.user += usertime.dwHighDateTime * 42950 + usertime.dwLowDateTime / 100000L;
395 clck->data.cpuclock.user += now.tms_utime;
400#if defined(_WIN32) || defined(_WIN64)
401 clck->data.wallclock.sec += time(
NULL);
403 gettimeofday(&tp,
NULL);
404 if( tp.tv_usec + clck->data.wallclock.usec > 1000000 )
406 clck->data.wallclock.sec += (tp.tv_sec + 1);
407 clck->data.wallclock.usec -= (1000000 - tp.tv_usec);
411 clck->data.wallclock.sec += tp.tv_sec;
412 clck->data.wallclock.usec += tp.tv_usec;
433 return (clck->
nruns > 0);
446 SCIPdebugMessage(
"getting time of clock %p (type %d, usedefault=%u, nruns=%d)\n",
453 else if( clck->
nruns == 0 )
474#if defined(_WIN32) || defined(_WIN64)
475 FILETIME creationtime;
488#if defined(_WIN32) || defined(_WIN64)
489 GetProcessTimes(GetCurrentProcess(), &creationtime, &exittime, &kerneltime, &usertime);
497#if defined(_WIN32) || defined(_WIN64)
500 gettimeofday(&tp,
NULL);
546 SCIPdebugMessage(
"setting time of clock %p (type %d, usedefault=%u, nruns=%d) to %g\n",
569 if( clck->
nruns >= 1 )
571#if defined(_WIN32) || defined(_WIN64)
572 FILETIME creationtime;
585#if defined(_WIN32) || defined(_WIN64)
586 GetProcessTimes(GetCurrentProcess(), &creationtime, &exittime, &kerneltime, &usertime);
587 clck->
data.
cpuclock.
user -= usertime.dwHighDateTime * 42950 + usertime.dwLowDateTime / 100000L;
595#if defined(_WIN32) || defined(_WIN64)
598 gettimeofday(&tp,
NULL);
625#if defined(_WIN32) || defined(_WIN64)
628 return (SCIP_Real)(now % (24*3600));
632 gettimeofday(&tp,
NULL);
634 return (SCIP_Real)(tp.tv_sec % (24*3600)) + (SCIP_Real)tp.tv_usec / 1e+6;
void SCIPclockEnable(SCIP_CLOCK *clck)
void SCIPclockSetTime(SCIP_CLOCK *clck, SCIP_Real sec)
SCIP_Real SCIPclockGetTimeOfDay(void)
void SCIPclockDisable(SCIP_CLOCK *clck)
static void sec2walltime(SCIP_Real sec, long *wallsec, long *wallusec)
static void clockUpdateDefaultType(SCIP_CLOCK *clck, SCIP_CLOCKTYPE defaultclocktype)
void SCIPclockSetType(SCIP_CLOCK *clck, SCIP_CLOCKTYPE clocktype)
void SCIPclockStop(SCIP_CLOCK *clck, SCIP_SET *set)
SCIP_Bool SCIPclockIsRunning(SCIP_CLOCK *clck)
static SCIP_Real walltime2sec(long sec, long usec)
void SCIPclockEnableOrDisable(SCIP_CLOCK *clck, SCIP_Bool enable)
void SCIPclockStart(SCIP_CLOCK *clck, SCIP_SET *set)
SCIP_Real SCIPclockGetLastTime(SCIP_CLOCK *clck)
SCIP_Real SCIPclockGetTime(SCIP_CLOCK *clck)
static void clockSetType(SCIP_CLOCK *clck, SCIP_CLOCKTYPE newtype)
void SCIPclockReset(SCIP_CLOCK *clck)
void SCIPclockInit(SCIP_CLOCK *clck, SCIP_CLOCKTYPE clocktype)
void SCIPclockFree(SCIP_CLOCK **clck)
static SCIP_Real cputime2sec(clock_t cputime)
SCIP_RETCODE SCIPclockCreate(SCIP_CLOCK **clck, SCIP_CLOCKTYPE clocktype)
static void sec2cputime(SCIP_Real sec, clock_t *cputime)
internal methods for clocks and timing issues
common defines and data types used in all packages of SCIP
assert(minobj< SCIPgetCutoffbound(scip))
memory allocation routines
#define BMSfreeMemory(ptr)
#define BMSallocMemory(ptr)
public methods for message output
internal methods for global SCIP settings
union SCIP_Clock::@322373357263374345075064311144162302317236017161 data
datastructures for clocks and timing issues
enum SCIP_ClockType SCIP_CLOCKTYPE
enum SCIP_Retcode SCIP_RETCODE