mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-22 02:33:03 +00:00
timevar: remove remains of GCC
* lib/timevar.h, lib/timevar.c: Rename the header guard. Get rid of parts meant for GCC only.
This commit is contained in:
@@ -20,26 +20,13 @@
|
|||||||
|
|
||||||
#include <config.h>
|
#include <config.h>
|
||||||
|
|
||||||
#if IN_GCC
|
/* This source file was taken from the GCC source code. */
|
||||||
|
|
||||||
#include "system.h"
|
|
||||||
#include "intl.h"
|
|
||||||
#include "rtl.h"
|
|
||||||
|
|
||||||
#else
|
|
||||||
|
|
||||||
/* This source file is taken from the GCC source code, with slight
|
|
||||||
modifications that are under control of the IN_GCC preprocessor
|
|
||||||
variable. The !IN_GCC part of this file is specific to Bison. */
|
|
||||||
|
|
||||||
# include "../src/system.h"
|
|
||||||
# if HAVE_SYS_TIME_H
|
|
||||||
# include <sys/time.h>
|
|
||||||
# endif
|
|
||||||
int timevar_report = 0;
|
|
||||||
|
|
||||||
|
#include "../src/system.h"
|
||||||
|
#if HAVE_SYS_TIME_H
|
||||||
|
# include <sys/time.h>
|
||||||
#endif
|
#endif
|
||||||
|
int timevar_report = 0;
|
||||||
|
|
||||||
#ifdef HAVE_SYS_TIMES_H
|
#ifdef HAVE_SYS_TIMES_H
|
||||||
# include <sys/times.h>
|
# include <sys/times.h>
|
||||||
@@ -72,10 +59,6 @@ extern clock_t times (struct tms *);
|
|||||||
extern clock_t clock (void);
|
extern clock_t clock (void);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef RUSAGE_SELF
|
|
||||||
# define RUSAGE_SELF 0
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Calculation of scale factor to convert ticks to microseconds.
|
/* Calculation of scale factor to convert ticks to microseconds.
|
||||||
We mustn't use CLOCKS_PER_SEC except with clock(). */
|
We mustn't use CLOCKS_PER_SEC except with clock(). */
|
||||||
#if HAVE_SYSCONF && defined _SC_CLK_TCK
|
#if HAVE_SYSCONF && defined _SC_CLK_TCK
|
||||||
@@ -126,9 +109,6 @@ static float clocks_to_msec;
|
|||||||
#define CLOCKS_TO_MSEC (1.0 / CLOCKS_PER_SEC)
|
#define CLOCKS_TO_MSEC (1.0 / CLOCKS_PER_SEC)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if IN_GCC
|
|
||||||
#include "flags.h"
|
|
||||||
#endif
|
|
||||||
#include "timevar.h"
|
#include "timevar.h"
|
||||||
|
|
||||||
/* See timevar.h for an explanation of timing variables. */
|
/* See timevar.h for an explanation of timing variables. */
|
||||||
@@ -211,21 +191,12 @@ get_time (now)
|
|||||||
#ifdef USE_TIMES
|
#ifdef USE_TIMES
|
||||||
struct tms tms;
|
struct tms tms;
|
||||||
now->wall = times (&tms) * ticks_to_msec;
|
now->wall = times (&tms) * ticks_to_msec;
|
||||||
#if IN_GCC
|
|
||||||
now->user = tms.tms_utime * ticks_to_msec;
|
|
||||||
now->sys = tms.tms_stime * ticks_to_msec;
|
|
||||||
#else
|
|
||||||
now->user = (tms.tms_utime + tms.tms_cutime) * ticks_to_msec;
|
now->user = (tms.tms_utime + tms.tms_cutime) * ticks_to_msec;
|
||||||
now->sys = (tms.tms_stime + tms.tms_cstime) * ticks_to_msec;
|
now->sys = (tms.tms_stime + tms.tms_cstime) * ticks_to_msec;
|
||||||
#endif
|
#endif
|
||||||
#endif
|
|
||||||
#ifdef USE_GETRUSAGE
|
#ifdef USE_GETRUSAGE
|
||||||
struct rusage rusage;
|
struct rusage rusage;
|
||||||
#if IN_GCC
|
|
||||||
getrusage (RUSAGE_SELF, &rusage);
|
|
||||||
#else
|
|
||||||
getrusage (RUSAGE_CHILDREN, &rusage);
|
getrusage (RUSAGE_CHILDREN, &rusage);
|
||||||
#endif
|
|
||||||
now->user = rusage.ru_utime.tv_sec + rusage.ru_utime.tv_usec * 1e-6;
|
now->user = rusage.ru_utime.tv_sec + rusage.ru_utime.tv_usec * 1e-6;
|
||||||
now->sys = rusage.ru_stime.tv_sec + rusage.ru_stime.tv_usec * 1e-6;
|
now->sys = rusage.ru_stime.tv_sec + rusage.ru_stime.tv_usec * 1e-6;
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -18,8 +18,8 @@
|
|||||||
You should have received a copy of the GNU General Public License
|
You should have received a copy of the GNU General Public License
|
||||||
along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
||||||
|
|
||||||
#ifndef GCC_TIMEVAR_H
|
#ifndef _TIMEVAR_H
|
||||||
#define GCC_TIMEVAR_H
|
#define _TIMEVAR_H
|
||||||
|
|
||||||
/* Timing variables are used to measure elapsed time in various
|
/* Timing variables are used to measure elapsed time in various
|
||||||
portions of the compiler. Each measures elapsed user, system, and
|
portions of the compiler. Each measures elapsed user, system, and
|
||||||
@@ -89,4 +89,4 @@ extern void print_time (const char *, long);
|
|||||||
|
|
||||||
extern int timevar_report;
|
extern int timevar_report;
|
||||||
|
|
||||||
#endif /* ! GCC_TIMEVAR_H */
|
#endif /* ! _TIMEVAR_H */
|
||||||
|
|||||||
Reference in New Issue
Block a user