1 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
2 /*                                                                           */
3 /*                  This file is part of the program and library             */
4 /*         SCIP --- Solving Constraint Integer Programs                      */
5 /*                                                                           */
6 /*    Copyright (C) 2002-2021 Konrad-Zuse-Zentrum                            */
7 /*                            fuer Informationstechnik Berlin                */
8 /*                                                                           */
9 /*  SCIP is distributed under the terms of the ZIB Academic License.         */
10 /*                                                                           */
11 /*  You should have received a copy of the ZIB Academic License              */
12 /*  along with SCIP; see the file COPYING. If not visit scipopt.org.         */
13 /*                                                                           */
14 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
15 
16 /**@file   clock.h
17  * @ingroup INTERNALAPI
18  * @brief  internal methods for clocks and timing issues
19  * @author Tobias Achterberg
20  */
21 
22 /*---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----0----+----1----+----2*/
23 
24 #ifndef __SCIP_CLOCK_H__
25 #define __SCIP_CLOCK_H__
26 
27 
28 #include "scip/def.h"
29 #include "scip/type_retcode.h"
30 #include "scip/type_set.h"
31 #include "scip/type_clock.h"
32 
33 #ifdef __cplusplus
34 extern "C" {
35 #endif
36 
37 /** creates a clock and initializes it */
38 SCIP_RETCODE SCIPclockCreate(
39    SCIP_CLOCK**          clck,               /**< pointer to clock timer */
40    SCIP_CLOCKTYPE        clocktype           /**< type of clock */
41    );
42 
43 /** frees a clock */
44 void SCIPclockFree(
45    SCIP_CLOCK**          clck                /**< pointer to clock timer */
46    );
47 
48 /** initializes and resets a clock */
49 void SCIPclockInit(
50    SCIP_CLOCK*           clck,               /**< clock timer */
51    SCIP_CLOCKTYPE        clocktype           /**< type of clock */
52    );
53 
54 /** completely stop the clock and reset the clock's counter to zero */
55 void SCIPclockReset(
56    SCIP_CLOCK*           clck                /**< clock timer */
57    );
58 
59 /** enables the clock */
60 void SCIPclockEnable(
61    SCIP_CLOCK*           clck                /**< clock timer */
62    );
63 
64 /** disables and resets the clock */
65 void SCIPclockDisable(
66    SCIP_CLOCK*           clck                /**< clock timer */
67    );
68 
69 /** enables or disables \p clck, depending on the value of the flag */
70 void SCIPclockEnableOrDisable(
71    SCIP_CLOCK*           clck,               /**< the clock to be disabled/enabled */
72    SCIP_Bool             enable              /**< should the clock be enabled? */
73    );
74 
75 /** sets the type of the clock, overriding the default clock type, and resets the clock */
76 void SCIPclockSetType(
77    SCIP_CLOCK*           clck,               /**< clock timer */
78    SCIP_CLOCKTYPE        clocktype           /**< type of clock */
79    );
80 
81 /** starts measurement of time in the given clock, update the clock's type if it is bound to the default type */
82 void SCIPclockStart(
83    SCIP_CLOCK*           clck,               /**< clock timer */
84    SCIP_SET*             set                 /**< global SCIP settings */
85    );
86 
87 /** stops measurement of time in the given clock */
88 void SCIPclockStop(
89    SCIP_CLOCK*           clck,               /**< clock timer */
90    SCIP_SET*             set                 /**< global SCIP settings */
91    );
92 
93 /** returns whether the clock is currently running */
94 SCIP_Bool SCIPclockIsRunning(
95    SCIP_CLOCK*           clck                /**< clock timer */
96    );
97 
98 /** gets the used time of this clock in seconds */
99 SCIP_Real SCIPclockGetTime(
100    SCIP_CLOCK*           clck                /**< clock timer */
101    );
102 
103 /** gets the last validated time of this clock in seconds */
104 SCIP_Real SCIPclockGetLastTime(
105    SCIP_CLOCK*           clck                /**< clock timer */
106    );
107 
108 
109 /** sets the used time of this clock in seconds */
110 void SCIPclockSetTime(
111    SCIP_CLOCK*           clck,               /**< clock timer */
112    SCIP_Real             sec                 /**< time in seconds to set the clock's timer to */
113    );
114 
115 /** gets current time of day in seconds (standard time zone) */
116 SCIP_Real SCIPclockGetTimeOfDay(
117    void
118    );
119 
120 #ifdef __cplusplus
121 }
122 #endif
123 
124 #endif
125