]> git.saurik.com Git - bison.git/blame - lib/timevar.h
portability: fix several issues with M4 subprocess.
[bison.git] / lib / timevar.h
CommitLineData
1509d42f 1/* Timing variables for measuring compiler performance.
219c26ea
JD
2 Copyright (C) 2000, 2002, 2004, 2009-2010 Free Software Foundation,
3 Inc.
1509d42f
AD
4 Contributed by Alex Samuel <samuel@codesourcery.com>
5
f16b0819 6 This program is free software: you can redistribute it and/or modify
02650b7f 7 it under the terms of the GNU General Public License as published by
f16b0819 8 the Free Software Foundation, either version 3 of the License, or
02650b7f 9 (at your option) any later version.
1509d42f 10
02650b7f
PE
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
1509d42f
AD
15
16 You should have received a copy of the GNU General Public License
f16b0819 17 along with this program. If not, see <http://www.gnu.org/licenses/>. */
1509d42f
AD
18
19#ifndef GCC_TIMEVAR_H
20#define GCC_TIMEVAR_H
21
22/* Timing variables are used to measure elapsed time in various
23 portions of the compiler. Each measures elapsed user, system, and
24 wall-clock time, as appropriate to and supported by the host
25 system.
26
27 Timing variables are defined using the DEFTIMEVAR macro in
28 timevar.def. Each has an enumeral identifier, used when referring
29 to the timing variable in code, and a character string name.
30
31 Timing variables can be used in two ways:
32
33 - On the timing stack, using timevar_push and timevar_pop.
34 Timing variables may be pushed onto the stack; elapsed time is
35 attributed to the topmost timing variable on the stack. When
36 another variable is pushed on, the previous topmost variable is
37 `paused' until the pushed variable is popped back off.
38
39 - As a standalone timer, using timevar_start and timevar_stop.
40 All time elapsed between the two calls is attributed to the
ea9ed226 41 variable.
1509d42f 42*/
ea9ed226 43
1509d42f
AD
44/* This structure stores the various varieties of time that can be
45 measured. Times are stored in seconds. The time may be an
46 absolute time or a time difference; in the former case, the time
47 base is undefined, except that the difference between two times
48 produces a valid time difference. */
49
50struct timevar_time_def
51{
52 /* User time in this process. */
53 float user;
54
55 /* System time (if applicable for this host platform) in this
56 process. */
57 float sys;
58
59 /* Wall clock time. */
60 float wall;
61};
62
63/* An enumeration of timing variable identifiers. Constructed from
64 the contents of timevar.def. */
65
66#define DEFTIMEVAR(identifier__, name__) \
ea9ed226 67 identifier__,
1509d42f
AD
68typedef enum
69{
70#include "timevar.def"
71 TIMEVAR_LAST
72}
73timevar_id_t;
74#undef DEFTIMEVAR
75
126e3751
PE
76extern void init_timevar (void);
77extern void timevar_push (timevar_id_t);
78extern void timevar_pop (timevar_id_t);
79extern void timevar_start (timevar_id_t);
80extern void timevar_stop (timevar_id_t);
81extern void timevar_get (timevar_id_t, struct timevar_time_def *);
82extern void timevar_print (FILE *);
1509d42f
AD
83
84/* Provided for backward compatibility. */
126e3751
PE
85extern long get_run_time (void);
86extern void print_time (const char *, long);
1509d42f 87
7c612afb
PE
88extern int timevar_report;
89
1509d42f 90#endif /* ! GCC_TIMEVAR_H */