45 #if defined(_WIN32) || defined(_WIN64) 48 #include <sys/times.h> 54 #include "scip/pub_message.h" 55 #include "blockmemshell/memory.h" 67 clock_t clocks_per_second;
69 #if defined(_WIN32) || defined(_WIN64) 70 clocks_per_second = 100;
73 clocks_per_second = sysconf(_SC_CLK_TCK);
75 clocks_per_second = CLK_TCK;
79 return (SCIP_Real)cputime / (SCIP_Real)clocks_per_second;
92 return (SCIP_Real)sec + 0.000001 * (SCIP_Real)usec;
100 assert(clck != NULL);
102 SCIP_ALLOC( BMSallocMemory(clck) );
115 assert(clck != NULL);
126 assert( clck != NULL );
128 SCIPdebugMessage(
"setting type of clock %p to %d.\n", (
void*)clck, clocktype);
138 #if defined(_WIN32) || defined(_WIN64) 139 FILETIME creationtime;
148 assert( clck != NULL );
149 assert( clck->
nruns == 0 );
151 SCIPdebugMessage(
"starting clock %p (type %d).\n", (
void*)clck, clck->
clocktype);
156 #if defined(_WIN32) || defined(_WIN64) 157 GetProcessTimes(GetCurrentProcess(), &creationtime, &exittime, &kerneltime, &usertime);
158 clck->
data.
cpuclock.
user = - usertime.dwHighDateTime * 42950 + usertime.dwLowDateTime / 100000L;
166 #if defined(_WIN32) || defined(_WIN64) 169 gettimeofday(&tp, NULL);
184 SCIPerrorMessage(
"invalid clock type\n");
196 #if defined(_WIN32) || defined(_WIN64) 197 FILETIME creationtime;
206 assert( clck != NULL );
207 assert( clck->
nruns == 1 );
211 SCIPdebugMessage(
"stopping clock %p (type %d)\n", (
void*)clck, clck->
clocktype);
216 #if defined(_WIN32) || defined(_WIN64) 217 GetProcessTimes(GetCurrentProcess(), &creationtime, &exittime, &kerneltime, &usertime);
218 clck->
data.
cpuclock.
user += usertime.dwHighDateTime * 42950 + usertime.dwLowDateTime / 100000L;
226 #if defined(_WIN32) || defined(_WIN64) 229 gettimeofday(&tp, NULL);
244 SCIPerrorMessage(
"invalid clock type\n");
254 SCIP_Real result = 0.0;
256 assert( clck != NULL );
258 SCIPdebugMessage(
"getting time of clock %p (type %d, nruns=%d)\n", (
void*)clck, clck->
clocktype, clck->
nruns);
260 if ( clck->
nruns == 0 )
272 SCIPerrorMessage(
"invalid clock type\n");
278 #if defined(_WIN32) || defined(_WIN64) 279 FILETIME creationtime;
292 #if defined(_WIN32) || defined(_WIN64) 293 GetProcessTimes(GetCurrentProcess(), &creationtime, &exittime, &kerneltime, &usertime);
302 #if defined(_WIN32) || defined(_WIN64) 305 gettimeofday(&tp, NULL);
314 SCIPerrorMessage(
"invalid clock type\n");
enum SDPI_ClockType SDPI_CLOCKTYPE
static SCIP_Real cputime2sec(clock_t cputime)
static SCIP_Real walltime2sec(long sec, long usec)
void SDPIclockFree(SDPI_CLOCK **clck)
SCIP_RETCODE SDPIclockCreate(SDPI_CLOCK **clck)
void SDPIclockStop(SDPI_CLOCK *clck)
void SDPIclockStart(SDPI_CLOCK *clck)
datastructures for clocks and timing issues
void SDPIclockSetType(SDPI_CLOCK *clck, SDPI_CLOCKTYPE clocktype)
SCIP_Real SDPIclockGetTime(SDPI_CLOCK *clck)
union SDPI_Clock::@0 data
methods for clocks and timing