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