]> gcc.gnu.org Git - gcc.git/blame - gcc/timevar.h
Daily bump.
[gcc.git] / gcc / timevar.h
CommitLineData
2a9a326b 1/* Timing variables for measuring compiler performance.
9dcd6f09 2 Copyright (C) 2000, 2003, 2004, 2005, 2007 Free Software Foundation, Inc.
2a9a326b
AS
3 Contributed by Alex Samuel <samuel@codesourcery.com>
4
1322177d 5 This file is part of GCC.
2a9a326b 6
1322177d
LB
7 GCC is free software; you can redistribute it and/or modify it
8 under the terms of the GNU General Public License as published by
9dcd6f09 9 the Free Software Foundation; either version 3, or (at your option)
2a9a326b
AS
10 any later version.
11
1322177d
LB
12 GCC is distributed in the hope that it will be useful, but WITHOUT
13 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
14 or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
15 License for more details.
2a9a326b
AS
16
17 You should have received a copy of the GNU General Public License
9dcd6f09
NC
18 along with GCC; see the file COPYING3. If not see
19 <http://www.gnu.org/licenses/>. */
2a9a326b 20
0e5921e8
ZW
21#ifndef GCC_TIMEVAR_H
22#define GCC_TIMEVAR_H
23
2a9a326b
AS
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
41077ce4 43 variable.
2a9a326b 44*/
41077ce4 45
2a9a326b 46/* This structure stores the various varieties of time that can be
20cc76d5 47 measured. Times are stored in seconds. The time may be an
2a9a326b
AS
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. */
4977bab6 55 double user;
2a9a326b
AS
56
57 /* System time (if applicable for this host platform) in this
58 process. */
4977bab6 59 double sys;
2a9a326b
AS
60
61 /* Wall clock time. */
4977bab6 62 double wall;
8d18c628
ZD
63
64 /* Garbage collector memory. */
65 unsigned ggc_mem;
2a9a326b
AS
66};
67
684d9f3b 68/* An enumeration of timing variable identifiers. Constructed from
2a9a326b
AS
69 the contents of timevar.def. */
70
71#define DEFTIMEVAR(identifier__, name__) \
41077ce4 72 identifier__,
2a9a326b
AS
73typedef enum
74{
75#include "timevar.def"
76 TIMEVAR_LAST
77}
78timevar_id_t;
79#undef DEFTIMEVAR
80
22ffcc6f 81/* Execute the sequence: timevar_pop (TV), return (E); */
89106ed5
AP
82#define POP_TIMEVAR_AND_RETURN(TV, E) do { timevar_pop (TV); return (E); }while(0)
83#define timevar_pop(TV) do { if (timevar_enable) timevar_pop_1 (TV); }while(0)
84#define timevar_push(TV) do { if (timevar_enable) timevar_push_1 (TV); }while(0)
22ffcc6f 85
46c5ad27 86extern void timevar_init (void);
89106ed5
AP
87extern void timevar_push_1 (timevar_id_t);
88extern void timevar_pop_1 (timevar_id_t);
46c5ad27
AJ
89extern void timevar_start (timevar_id_t);
90extern void timevar_stop (timevar_id_t);
46c5ad27 91extern void timevar_print (FILE *);
2a9a326b
AS
92
93/* Provided for backward compatibility. */
46c5ad27 94extern void print_time (const char *, long);
0e5921e8 95
89106ed5
AP
96extern bool timevar_enable;
97
8d18c628
ZD
98extern size_t timevar_ggc_mem_total;
99
88657302 100#endif /* ! GCC_TIMEVAR_H */
This page took 3.214279 seconds and 5 git commands to generate.