Scippy

SCIP

Solving Constraint Integer Programs

clock.c File Reference

Detailed Description

methods for clocks and timing issues

Author
Tobias Achterberg

Definition in file clock.c.

#include <assert.h>
#include <sys/times.h>
#include <sys/time.h>
#include <unistd.h>
#include <time.h>
#include "scip/def.h"
#include "scip/pub_message.h"
#include "blockmemshell/memory.h"
#include "scip/set.h"
#include "scip/clock.h"
#include "scip/struct_clock.h"

Go to the source code of this file.

Functions

static SCIP_Real cputime2sec (clock_t cputime)
 
static SCIP_Real walltime2sec (long sec, long usec)
 
static void sec2cputime (SCIP_Real sec, clock_t *cputime)
 
static void sec2walltime (SCIP_Real sec, long *wallsec, long *wallusec)
 
static void clockSetType (SCIP_CLOCK *clck, SCIP_CLOCKTYPE newtype)
 
static void clockUpdateDefaultType (SCIP_CLOCK *clck, SCIP_CLOCKTYPE defaultclocktype)
 
SCIP_RETCODE SCIPclockCreate (SCIP_CLOCK **clck, SCIP_CLOCKTYPE clocktype)
 
void SCIPclockFree (SCIP_CLOCK **clck)
 
void SCIPclockInit (SCIP_CLOCK *clck, SCIP_CLOCKTYPE clocktype)
 
void SCIPclockReset (SCIP_CLOCK *clck)
 
void SCIPclockEnable (SCIP_CLOCK *clck)
 
void SCIPclockDisable (SCIP_CLOCK *clck)
 
void SCIPclockEnableOrDisable (SCIP_CLOCK *clck, SCIP_Bool enable)
 
void SCIPclockSetType (SCIP_CLOCK *clck, SCIP_CLOCKTYPE clocktype)
 
void SCIPclockStart (SCIP_CLOCK *clck, SCIP_SET *set)
 
void SCIPclockStop (SCIP_CLOCK *clck, SCIP_SET *set)
 
SCIP_Bool SCIPclockIsRunning (SCIP_CLOCK *clck)
 
SCIP_Real SCIPclockGetTime (SCIP_CLOCK *clck)
 
SCIP_Real SCIPclockGetLastTime (SCIP_CLOCK *clck)
 
void SCIPclockSetTime (SCIP_CLOCK *clck, SCIP_Real sec)
 
SCIP_Real SCIPclockGetTimeOfDay (void)
 

Function Documentation

static SCIP_Real cputime2sec ( clock_t  cputime)
static

converts CPU clock ticks into seconds

Parameters
cputimeclock ticks for CPU time

Definition at line 43 of file clock.c.

References SCIP_Real.

Referenced by SCIPclockGetTime(), and SCIPclockStart().

static SCIP_Real walltime2sec ( long  sec,
long  usec 
)
static

converts wall clock time into seconds

Parameters
secseconds counter
usecmicroseconds counter

Definition at line 67 of file clock.c.

References SCIP_Real.

Referenced by SCIPclockGetTime(), and SCIPclockStart().

static void sec2cputime ( SCIP_Real  sec,
clock_t *  cputime 
)
static

converts seconds into CPU clock ticks

Parameters
secseconds
cputimepointer to store clock ticks for CPU time

Definition at line 77 of file clock.c.

References NULL.

Referenced by SCIPclockSetTime().

static void sec2walltime ( SCIP_Real  sec,
long *  wallsec,
long *  wallusec 
)
static

converts wall clock time into seconds

Parameters
secseconds
wallsecpointer to store seconds counter
wallusecpointer to store microseconds counter

Definition at line 100 of file clock.c.

References NULL.

Referenced by SCIPclockSetTime().

static void clockSetType ( SCIP_CLOCK clck,
SCIP_CLOCKTYPE  newtype 
)
static

sets the clock's type and converts the clock timer accordingly

Parameters
clckclock timer
newtypenew clock type

Definition at line 116 of file clock.c.

References SCIP_Clock::clocktype, SCIP_Clock::nruns, NULL, SCIP_CLOCKTYPE_DEFAULT, SCIP_Real, SCIPclockGetTime(), SCIPclockReset(), SCIPclockSetTime(), and SCIPdebugMessage.

Referenced by clockUpdateDefaultType(), and SCIPclockSetTime().

static void clockUpdateDefaultType ( SCIP_CLOCK clck,
SCIP_CLOCKTYPE  defaultclocktype 
)
static

if the clock uses the default clock type and the default changed, converts the clock timer to the new type

Parameters
clckclock timer
defaultclocktypedefault type of clock to use

Definition at line 147 of file clock.c.

References clockSetType(), SCIP_Clock::clocktype, NULL, SCIP_CLOCKTYPE_DEFAULT, and SCIP_Clock::usedefault.

Referenced by SCIPclockStart().

void SCIPclockInit ( SCIP_CLOCK clck,
SCIP_CLOCKTYPE  clocktype 
)

initializes and resets a clock

Parameters
clckclock timer
clocktypetype of clock

Definition at line 185 of file clock.c.

References SCIP_Clock::enabled, SCIP_Clock::lasttime, NULL, SCIPclockSetType(), SCIPdebugMessage, and TRUE.

Referenced by SCIPclockCreate().

void SCIPclockEnable ( SCIP_CLOCK clck)

enables the clock

Parameters
clckclock timer

Definition at line 225 of file clock.c.

References SCIP_Clock::clocktype, SCIP_Clock::enabled, NULL, SCIPdebugMessage, TRUE, and SCIP_Clock::usedefault.

Referenced by SCIPclockEnableOrDisable().

void SCIPclockDisable ( SCIP_CLOCK clck)

disables and resets the clock

Parameters
clckclock timer

Definition at line 237 of file clock.c.

References SCIP_Clock::clocktype, SCIP_Clock::enabled, FALSE, NULL, SCIPclockReset(), SCIPdebugMessage, and SCIP_Clock::usedefault.

Referenced by SCIPclockEnableOrDisable().

void SCIPclockSetType ( SCIP_CLOCK clck,
SCIP_CLOCKTYPE  clocktype 
)

sets the type of the clock, overriding the default clock type, and resets the clock

Parameters
clckclock timer
clocktypetype of clock

Definition at line 264 of file clock.c.

References SCIP_Clock::clocktype, NULL, SCIP_CLOCKTYPE_DEFAULT, SCIPclockReset(), SCIPdebugMessage, and SCIP_Clock::usedefault.

Referenced by SCIPclockInit().

void SCIPclockStart ( SCIP_CLOCK clck,
SCIP_SET set 
)

starts measurement of time in the given clock

Parameters
clckclock timer
setglobal SCIP settings

Definition at line 280 of file clock.c.

References SCIP_Clock::clocktype, clockUpdateDefaultType(), SCIP_Clock::cpuclock, cputime2sec(), SCIP_Clock::data, SCIP_Clock::enabled, SCIP_Clock::lasttime, SCIP_Clock::nruns, NULL, SCIP_CLOCKTYPE_CPU, SCIP_CLOCKTYPE_DEFAULT, SCIP_CLOCKTYPE_WALL, SCIPABORT, SCIPdebugMessage, SCIPerrorMessage, SCIP_WallClock::sec, SCIP_WallClock::usec, SCIP_Clock::usedefault, SCIP_CPUClock::user, SCIP_Clock::wallclock, and walltime2sec().

Referenced by addCurrentSolution(), addNode(), conflictAddConflictCons(), conflictAnalyzeBoundexceedingLP(), conflictAnalyzeInfeasibleLP(), conflictAnalyzeLP(), lpBarrier(), lpDualSimplex(), lpLexDualSimplex(), lpPrimalSimplex(), nlpSolve(), nodeRepropagate(), performStrongbranchWithPropagation(), presolve(), SCIPbranchruleExecExternSol(), SCIPbranchruleExecLPSol(), SCIPbranchruleExecPseudoSol(), SCIPbranchruleExit(), SCIPbranchruleExitsol(), SCIPbranchruleInit(), SCIPbranchruleInitsol(), SCIPcolGetStrongbranch(), SCIPcolGetStrongbranches(), SCIPcomprExec(), SCIPcomprExit(), SCIPcomprInit(), SCIPconflictAnalyze(), SCIPconflictAnalyzePseudo(), SCIPconflictAnalyzeStrongbranch(), SCIPconflicthdlrExec(), SCIPconflicthdlrExit(), SCIPconflicthdlrExitsol(), SCIPconflicthdlrInit(), SCIPconflicthdlrInitsol(), SCIPconshdlrCheck(), SCIPconshdlrEnforceLPSol(), SCIPconshdlrEnforcePseudoSol(), SCIPconshdlrExit(), SCIPconshdlrExitpre(), SCIPconshdlrExitsol(), SCIPconshdlrInit(), SCIPconshdlrInitLP(), SCIPconshdlrInitpre(), SCIPconshdlrInitsol(), SCIPconshdlrPresolve(), SCIPconshdlrPropagate(), SCIPconshdlrSeparateLP(), SCIPconshdlrSeparateSol(), SCIPconsResolvePropagation(), SCIPcopy(), SCIPcopyOrig(), SCIPcreate(), SCIPcutpoolSeparate(), SCIPeventhdlrExec(), SCIPeventhdlrExit(), SCIPeventhdlrExitsol(), SCIPeventhdlrInit(), SCIPeventhdlrInitsol(), SCIPheurExec(), SCIPheurExit(), SCIPheurExitsol(), SCIPheurInit(), SCIPheurInitsol(), SCIPnodeselExit(), SCIPnodeselExitsol(), SCIPnodeselInit(), SCIPnodeselInitsol(), SCIPnodeselSelect(), SCIPpresolExec(), SCIPpresolExit(), SCIPpresolExitpre(), SCIPpresolInit(), SCIPpresolInitpre(), SCIPpresolve(), SCIPpricerExit(), SCIPpricerExitsol(), SCIPpricerFarkas(), SCIPpricerInit(), SCIPpricerInitsol(), SCIPpricerRedcost(), SCIPpricestoreAddProbVars(), SCIPpropExec(), SCIPpropExit(), SCIPpropExitpre(), SCIPpropExitsol(), SCIPpropInit(), SCIPpropInitpre(), SCIPpropInitsol(), SCIPpropPresol(), SCIPpropResolvePropagation(), SCIPreaderRead(), SCIPrelaxExec(), SCIPrelaxExit(), SCIPrelaxExitsol(), SCIPrelaxInit(), SCIPrelaxInitsol(), SCIPsepaExecLP(), SCIPsepaExecSol(), SCIPsepaExit(), SCIPsepaExitsol(), SCIPsepaInit(), SCIPsepaInitsol(), SCIPsolve(), SCIPsolveCIP(), SCIPstartClock(), and SCIPstartSolvingTime().

void SCIPclockStop ( SCIP_CLOCK clck,
SCIP_SET set 
)

stops measurement of time in the given clock

Parameters
clckclock timer
setglobal SCIP settings

Definition at line 350 of file clock.c.

References SCIP_Clock::clocktype, SCIP_Clock::cpuclock, SCIP_Clock::data, SCIP_Clock::enabled, SCIP_Clock::nruns, NULL, SCIP_CLOCKTYPE_CPU, SCIP_CLOCKTYPE_DEFAULT, SCIP_CLOCKTYPE_WALL, SCIPABORT, SCIPdebugMessage, SCIPerrorMessage, SCIP_WallClock::sec, SCIP_WallClock::usec, SCIP_Clock::usedefault, SCIP_CPUClock::user, and SCIP_Clock::wallclock.

Referenced by addCurrentSolution(), addNode(), conflictAddConflictCons(), conflictAnalyzeBoundexceedingLP(), conflictAnalyzeInfeasibleLP(), conflictAnalyzeLP(), lpBarrier(), lpDualSimplex(), lpLexDualSimplex(), lpPrimalSimplex(), nlpSolve(), nodeRepropagate(), performStrongbranchWithPropagation(), presolve(), SCIPbranchruleExecExternSol(), SCIPbranchruleExecLPSol(), SCIPbranchruleExecPseudoSol(), SCIPbranchruleExit(), SCIPbranchruleExitsol(), SCIPbranchruleInit(), SCIPbranchruleInitsol(), SCIPcolGetStrongbranch(), SCIPcolGetStrongbranches(), SCIPcomprExec(), SCIPcomprExit(), SCIPcomprInit(), SCIPconflictAnalyze(), SCIPconflictAnalyzePseudo(), SCIPconflictAnalyzeStrongbranch(), SCIPconflicthdlrExec(), SCIPconflicthdlrExit(), SCIPconflicthdlrExitsol(), SCIPconflicthdlrInit(), SCIPconflicthdlrInitsol(), SCIPconshdlrCheck(), SCIPconshdlrEnforceLPSol(), SCIPconshdlrEnforcePseudoSol(), SCIPconshdlrExit(), SCIPconshdlrExitpre(), SCIPconshdlrExitsol(), SCIPconshdlrInit(), SCIPconshdlrInitLP(), SCIPconshdlrInitpre(), SCIPconshdlrInitsol(), SCIPconshdlrPresolve(), SCIPconshdlrPropagate(), SCIPconshdlrSeparateLP(), SCIPconshdlrSeparateSol(), SCIPconsResolvePropagation(), SCIPcopy(), SCIPcopyOrig(), SCIPcutpoolSeparate(), SCIPeventhdlrExec(), SCIPeventhdlrExit(), SCIPeventhdlrExitsol(), SCIPeventhdlrInit(), SCIPeventhdlrInitsol(), SCIPheurExec(), SCIPheurExit(), SCIPheurExitsol(), SCIPheurInit(), SCIPheurInitsol(), SCIPnodeselExit(), SCIPnodeselExitsol(), SCIPnodeselInit(), SCIPnodeselInitsol(), SCIPnodeselSelect(), SCIPpresolExec(), SCIPpresolExit(), SCIPpresolExitpre(), SCIPpresolInit(), SCIPpresolInitpre(), SCIPpresolve(), SCIPpricerExit(), SCIPpricerExitsol(), SCIPpricerFarkas(), SCIPpricerInit(), SCIPpricerInitsol(), SCIPpricerRedcost(), SCIPpricestoreAddProbVars(), SCIPpropExec(), SCIPpropExit(), SCIPpropExitpre(), SCIPpropExitsol(), SCIPpropInit(), SCIPpropInitpre(), SCIPpropInitsol(), SCIPpropPresol(), SCIPpropResolvePropagation(), SCIPreaderRead(), SCIPrelaxExec(), SCIPrelaxExit(), SCIPrelaxExitsol(), SCIPrelaxInit(), SCIPrelaxInitsol(), SCIPsepaExecLP(), SCIPsepaExecSol(), SCIPsepaExit(), SCIPsepaExitsol(), SCIPsepaInit(), SCIPsepaInitsol(), SCIPsolve(), SCIPsolveCIP(), SCIPstopClock(), and SCIPstopSolvingTime().

SCIP_Bool SCIPclockIsRunning ( SCIP_CLOCK clck)

returns whether the clock is currently running

Parameters
clckclock timer

Definition at line 417 of file clock.c.

References SCIP_Clock::nruns, and NULL.

Referenced by nodeRepropagate(), and SCIPreaderRead().

SCIP_Real SCIPclockGetTime ( SCIP_CLOCK clck)

gets the used time of this clock in seconds

Parameters
clckclock timer

Definition at line 428 of file clock.c.

References SCIP_Clock::clocktype, SCIP_Clock::cpuclock, cputime2sec(), SCIP_Clock::data, SCIP_Clock::lasttime, SCIP_Clock::nruns, NULL, SCIP_CLOCKTYPE_CPU, SCIP_CLOCKTYPE_DEFAULT, SCIP_CLOCKTYPE_WALL, SCIP_Real, SCIPABORT, SCIPdebugMessage, SCIPerrorMessage, SCIP_WallClock::sec, SCIP_WallClock::usec, SCIP_Clock::usedefault, SCIP_CPUClock::user, SCIP_Clock::wallclock, and walltime2sec().

Referenced by applyVbounds(), clockSetType(), displayRelevantStats(), lpAlgorithm(), lpBarrier(), lpDualSimplex(), lpLexDualSimplex(), lpPrimalSimplex(), printHeuristicStatistics(), printLPStatistics(), printNLPStatistics(), printTime(), printTimingStatistics(), printTreeStatistics(), SCIPbranchruleGetSetupTime(), SCIPbranchruleGetTime(), SCIPcomprGetSetupTime(), SCIPcomprGetTime(), SCIPconflictGetBoundexceedingLPTime(), SCIPconflictGetGlobalApplTime(), SCIPconflictGetInfeasibleLPTime(), SCIPconflictGetPropTime(), SCIPconflictGetPseudoTime(), SCIPconflictGetStrongbranchTime(), SCIPconflicthdlrGetSetupTime(), SCIPconflicthdlrGetTime(), SCIPconshdlrGetCheckTime(), SCIPconshdlrGetEnfoLPTime(), SCIPconshdlrGetEnfoPSTime(), SCIPconshdlrGetPresolTime(), SCIPconshdlrGetPropTime(), SCIPconshdlrGetRespropTime(), SCIPconshdlrGetSepaTime(), SCIPconshdlrGetSetupTime(), SCIPconshdlrGetStrongBranchPropTime(), SCIPcopy(), SCIPcopyOrig(), SCIPcutpoolGetTime(), SCIPeventhdlrGetSetupTime(), SCIPeventhdlrGetTime(), SCIPgetClockTime(), SCIPgetPresolvingTime(), SCIPgetSolvingTime(), SCIPgetTotalTime(), SCIPheurGetSetupTime(), SCIPheurGetTime(), SCIPnodeselGetSetupTime(), SCIPnodeselGetTime(), SCIPpresolGetSetupTime(), SCIPpresolGetTime(), SCIPpresolve(), SCIPpricerGetSetupTime(), SCIPpricerGetTime(), SCIPpricestoreGetProbPricingTime(), SCIPprintReoptStatistics(), SCIPpropGetPresolTime(), SCIPpropGetRespropTime(), SCIPpropGetSetupTime(), SCIPpropGetStrongBranchPropTime(), SCIPpropGetTime(), SCIPreaderGetReadingTime(), SCIPreaderRead(), SCIPrelaxGetSetupTime(), SCIPrelaxGetTime(), SCIPreoptGetSavingtime(), SCIPsepaGetSetupTime(), SCIPsepaGetTime(), SCIPsolveIsStopped(), SCIPstatUpdatePrimalDualIntegral(), solStamp(), and solveNodeInitialLP().

SCIP_Real SCIPclockGetLastTime ( SCIP_CLOCK clck)

gets the last validated time of this clock in seconds

Parameters
clckclock timer

Definition at line 508 of file clock.c.

References SCIP_Clock::lasttime, and NULL.

Referenced by SCIPsolveIsStopped(), and solStamp().

void SCIPclockSetTime ( SCIP_CLOCK clck,
SCIP_Real  sec 
)
SCIP_Real SCIPclockGetTimeOfDay ( void  )

gets current time of day in seconds (standard time zone)

Definition at line 600 of file clock.c.

References NULL, and SCIP_Real.

Referenced by SCIPgetTimeOfDay().