00001 /* Timing variables for measuring compiler performance. 00002 Copyright (C) 2000, 2003, 2004, 2005 Free Software Foundation, Inc. 00003 Contributed by Alex Samuel <samuel@codesourcery.com> 00004 00005 This file is part of GCC. 00006 00007 GCC is free software; you can redistribute it and/or modify it 00008 under the terms of the GNU General Public License as published by 00009 the Free Software Foundation; either version 2, or (at your option) 00010 any later version. 00011 00012 GCC is distributed in the hope that it will be useful, but WITHOUT 00013 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 00014 or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public 00015 License for more details. 00016 00017 You should have received a copy of the GNU General Public License 00018 along with GCC; see the file COPYING. If not, write to the Free 00019 Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 00020 02110-1301, USA. */ 00021 00022 #ifndef GCC_TIMEVAR_H 00023 #define GCC_TIMEVAR_H 00024 00025 /* Timing variables are used to measure elapsed time in various 00026 portions of the compiler. Each measures elapsed user, system, and 00027 wall-clock time, as appropriate to and supported by the host 00028 system. 00029 00030 Timing variables are defined using the DEFTIMEVAR macro in 00031 timevar.def. Each has an enumeral identifier, used when referring 00032 to the timing variable in code, and a character string name. 00033 00034 Timing variables can be used in two ways: 00035 00036 - On the timing stack, using timevar_push and timevar_pop. 00037 Timing variables may be pushed onto the stack; elapsed time is 00038 attributed to the topmost timing variable on the stack. When 00039 another variable is pushed on, the previous topmost variable is 00040 `paused' until the pushed variable is popped back off. 00041 00042 - As a standalone timer, using timevar_start and timevar_stop. 00043 All time elapsed between the two calls is attributed to the 00044 variable. 00045 */ 00046 00047 /* This structure stores the various varieties of time that can be 00048 measured. Times are stored in seconds. The time may be an 00049 absolute time or a time difference; in the former case, the time 00050 base is undefined, except that the difference between two times 00051 produces a valid time difference. */ 00052 00053 struct timevar_time_def 00054 { 00055 /* User time in this process. */ 00056 double user; 00057 00058 /* System time (if applicable for this host platform) in this 00059 process. */ 00060 double sys; 00061 00062 /* Wall clock time. */ 00063 double wall; 00064 00065 /* Garbage collector memory. */ 00066 unsigned ggc_mem; 00067 }; 00068 00069 /* An enumeration of timing variable identifiers. Constructed from 00070 the contents of timevar.def. */ 00071 00072 #define DEFTIMEVAR(identifier__, name__) \ 00073 identifier__, 00074 typedef enum 00075 { 00076 #include "timevar.def" 00077 TIMEVAR_LAST 00078 } 00079 timevar_id_t; 00080 #undef DEFTIMEVAR 00081 00082 /* Execute the sequence: timevar_pop (TV), return (E); */ 00083 #define POP_TIMEVAR_AND_RETURN(TV, E) do { timevar_pop (TV); return (E); }while(0) 00084 #define timevar_pop(TV) do { if (timevar_enable) timevar_pop_1 (TV); }while(0) 00085 #define timevar_push(TV) do { if (timevar_enable) timevar_push_1 (TV); }while(0) 00086 00087 extern void timevar_init (void); 00088 extern void timevar_push_1 (timevar_id_t); 00089 extern void timevar_pop_1 (timevar_id_t); 00090 extern void timevar_start (timevar_id_t); 00091 extern void timevar_stop (timevar_id_t); 00092 extern void timevar_print (FILE *); 00093 00094 /* Provided for backward compatibility. */ 00095 extern void print_time (const char *, long); 00096 00097 extern bool timevar_enable; 00098 00099 extern size_t timevar_ggc_mem_total; 00100 00101 #endif /* ! GCC_TIMEVAR_H */
1.5.6