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