]>
Commit | Line | Data |
---|---|---|
1 | /* Timing variables for measuring compiler performance. | |
2 | ||
3 | Copyright (C) 2000, 2002, 2004, 2009-2011 Free Software Foundation, | |
4 | Inc. | |
5 | ||
6 | Contributed by Alex Samuel <samuel@codesourcery.com> | |
7 | ||
8 | This program is free software: you can redistribute it and/or modify | |
9 | it under the terms of the GNU General Public License as published by | |
10 | the Free Software Foundation, either version 3 of the License, or | |
11 | (at your option) any later version. | |
12 | ||
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. | |
17 | ||
18 | You should have received a copy of the GNU General Public License | |
19 | along with this program. If not, see <http://www.gnu.org/licenses/>. */ | |
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 | |
43 | variable. | |
44 | */ | |
45 | ||
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 | ||
52 | struct 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__) \ | |
69 | identifier__, | |
70 | typedef enum | |
71 | { | |
72 | #include "timevar.def" | |
73 | TIMEVAR_LAST | |
74 | } | |
75 | timevar_id_t; | |
76 | #undef DEFTIMEVAR | |
77 | ||
78 | extern void init_timevar (void); | |
79 | extern void timevar_push (timevar_id_t); | |
80 | extern void timevar_pop (timevar_id_t); | |
81 | extern void timevar_start (timevar_id_t); | |
82 | extern void timevar_stop (timevar_id_t); | |
83 | extern void timevar_get (timevar_id_t, struct timevar_time_def *); | |
84 | extern void timevar_print (FILE *); | |
85 | ||
86 | /* Provided for backward compatibility. */ | |
87 | extern long get_run_time (void); | |
88 | extern void print_time (const char *, long); | |
89 | ||
90 | extern int timevar_report; | |
91 | ||
92 | #endif /* ! GCC_TIMEVAR_H */ |