mirror of
https://github.com/Mercury-Language/mercury.git
synced 2025-12-17 06:47:17 +00:00
Estimated hours taken: 2.5 Branches: main Add MR_ prefixes to uses of configuration macros. Bootcheck now succeeds with MR_NO_CONF_BACKWARDS_COMPAT. Mmake.common.in: Define MR_NO_CONF_BACKWARDS_COMPAT when checking for namespace cleanliness. RESERVED_MACRO_NAMES: Remove the configuration macros. runtime/mercury_conf_bootstrap.h: Remove a duplicate definition of BOXED_FLOAT. configure.in: */*.c: */*.h: */*.m: Add MR_ prefixes.
51 lines
1.4 KiB
C
51 lines
1.4 KiB
C
/*
|
|
** Copyright (C) 1993-1995, 1997, 2000 The University of Melbourne.
|
|
** This file may only be copied under the terms of the GNU Library General
|
|
** Public License - see the file COPYING.LIB in the Mercury distribution.
|
|
*/
|
|
|
|
/*
|
|
** mercury_timing.h - interface to timing routines.
|
|
** Defines `MR_CLOCK_TICKS_PER_SECOND'
|
|
** and `MR_get_user_cpu_miliseconds()'.
|
|
*/
|
|
|
|
#ifndef MERCURY_TIMING_H
|
|
#define MERCURY_TIMING_H
|
|
|
|
#include "mercury_conf.h"
|
|
|
|
#ifdef MR_HAVE_SYS_PARAM_H
|
|
#include <sys/param.h> /* for HZ */
|
|
#endif
|
|
|
|
#ifdef MR_HAVE_UNISTD_H
|
|
#include <unistd.h> /* for sysconf() and _SC_CLK_TCK */
|
|
#endif
|
|
|
|
#include <limits.h> /* CLK_TCK defined here, on some systems */
|
|
|
|
/*
|
|
** `HZ' is the number of clock ticks per second.
|
|
** It is used when converting a clock_t value to a time in seconds.
|
|
** It may be defined by <sys/time.h>, but if it is not defined there,
|
|
** we may be able to use `sysconf(_SC_CLK_TCK)' or CLK_TCK instead.
|
|
*/
|
|
#ifdef HZ
|
|
#define MR_CLOCK_TICKS_PER_SECOND HZ
|
|
#elif defined(MR_HAVE_SYSCONF) && defined(_SC_CLK_TCK)
|
|
#define MR_CLOCK_TICKS_PER_SECOND ((int) sysconf(_SC_CLK_TCK))
|
|
#elif defined(CLK_TCK)
|
|
#define MR_CLOCK_TICKS_PER_SECOND CLK_TCK
|
|
#else
|
|
/* just leave it undefined */
|
|
#endif
|
|
|
|
/*
|
|
** MR_get_user_cpu_miliseconds() returns the CPU time consumed by the
|
|
** process, in miliseconds, from an arbitrary initial time.
|
|
*/
|
|
int MR_get_user_cpu_miliseconds(void);
|
|
|
|
#endif /* MERCURY_TIMING_H */
|