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