575bfb0052
Index: gcc/ChangeLog 2011-04-27 Lawrence Crowl <crowl@google.com> * timevar.h (timevar_cond_start): Remove unused POP_TIMEVAR_AND_RETURN. (timevar_cond_start): New for starting a timer only when it is not already running. (timevar_cond_stop): New for stopping a timer when it was not already running. * timevar.c (timevar_stop): Enable start/stop timers to start again. (timevar_cond_start): New as above. (timevar_cond_stop): New as above. * timevar.def: Add start/stop timers for compiler phases, TV_PHASE_SETUP, TV_PHASE_PARSING, TV_PHASE_DEFERRED, TV_PHASE_CGRAPH, TV_PHASE_DBGINFO (C), TV_PHASE_CHECK_DBGINFO (C++), TV_PHASE_GENERATE, and TV_PHASE_FINALIZE. Change push/pop timer TV_PARSE to TV_PARSE_GLOBAL. Add push/pop timers TV_PARSE_STRUCT, TV_PARSE_ENUM, TV_PARSE_FUNC, TV_PARSE_INLINE, TV_PARSE_INMETH, TV_TEMPLATE_INST. Change push/pop timer TV_NAME_LOOKUP into a start/stop timer. Make unused TV_OVERLOAD into a start/stop timer. Remove unused timers TV_OVERLOAD, TV_TEMPLATE_INSTANTIATION. Mark the strings for TV_NAME_LOOKUP and TV_OVERLOAD with a "|" to indicate that they are start/stop timers. * toplev.c (compile_file): Change TV_PARSE to TV_PARSE_GLOBAL. Add start/stop timers TV_PHASE_PARSING and TV_PHASE_GENERATE. Move initialization to do_compile. (do_compile): Add initialization from above. Add start/stop timers TV_PHASE_SETUP and TV_PHASE_FINALIZE. * c-decl.c (c_write_global_declarations): Add start/stop of TV_PHASE_DEFERRED, TV_PHASE_CGRAPH, TV_PHASE_DBGINFO. * c-parser.c (c_parser_declaration_or_fndef): Push/pop TV_PARSE_FUNC or TV_PARSE_INLINE, as appropriate. (c_parser_enum_specifier): Push/pop TV_PARSE_ENUM. (c_parser_struct_or_union_specifier): Push/pop TV_PARSE_STRUCT. Index: gcc/cp/ChangeLog 2011-04-27 Lawrence Crowl <crowl@google.com> * decl.c: (push_local_name): Change TV_NAME_LOOKUP to start/stop. (poplevel): Refactor POP_TIMEVAR_AND_RETURN to plain code. Change TV_NAME_LOOKUP to start/stop. (define_label): Refactor timevar calls out to a wrapper function. Change TV_NAME_LOOKUP to start/stop. (xref_tag): Likewise. (lookup_label): Refactor timevar calls out to a wrapper function. Change TV_NAME_LOOKUP to start_cond/stop_cond. * pt.c: (instantiate_class_template): Add a wrapper to push/pop new TV_TEMPLATE_INST. (instantiate_template): Add a wrapper to push/pop new TV_TEMPLATE_INST. (lookup_template_class): Refactor timevar calls out to a wrapper function. Change use of TV_NAME_LOOKUP to TV_TEMPLATE_INST. (instantiate_decl): Change TV_PARSE to TV_TEMPLATE_INST. * name-lookup.c: (store_bindings): Change TV_NAME_LOOKUP to start/stop. (poplevel_class): Change TV_NAME_LOOKUP to start_cond/stop_cond. (push_namespace): Likewise. (pop_nested_namespace): Likewise. (pushdecl_namespace_level): Likewise. (store_class_bindings): Likewise. (push_to_top_level): Likewise. (identifier_type_value): Refactor timevar calls out to a wrapper function. Change TV_NAME_LOOKUP to start/stop. (find_binding): Likewise. (push_using_decl): Likewise. (lookup_arg_dependent): Likewise. (push_using_directive): Likewise. (qualified_lookup_using_namespace): Refactor POP_TIMEVAR_AND_RETURN to plain code. Change TV_NAME_LOOKUP to start/stop. (lookup_type_current_level): Likewise. Refactor inner return to break. (pushdecl_class_level): Refactor POP_TIMEVAR_AND_RETURN to plain code. Change TV_NAME_LOOKUP to start_cond/stop_cond. (pushdecl_top_level_1): Likewise. (lookup_using_namespace): Likewise. (pushdecl_with_scope): Refactor timevar calls out to a wrapper function. Change TV_NAME_LOOKUP to start_cond/stop_cond. (push_overloaded_decl): Likewise. (push_class_level_binding): Likewise. (namespace_binding): Likewise. (set_namespace_binding): Likewise. (supplement_binding): Likewise. (unqualified_namespace_lookup): Likewise. (lookup_name_real): Likewise. (lookup_type_scope): Likewise. (namespace_ancestor): Likewise. (lookup_name_innermost_nonclass_level): Likewise. (pushtag): Likewise. (pop_from_top_level): Likewise. (pushdecl_maybe_friend): Refactor timevar calls out to a wrapper function. Change TV_NAME_LOOKUP to start_cond/stop_cond. Wrap long lines. (add_using_namespace): Refactor timevar calls out to a wrapper function. Change TV_NAME_LOOKUP to start_cond/stop_cond. Bypass wrapper on call to self. * decl2.c: (cp_write_global_declarations): Add start/stop of new TV_PHASE_DEFERRED, TV_PHASE_CGRAPH, TV_PHASE_CHECK_DBGINFO. Remove push/pop calls to TV_VARCONST. * parser.c: Add include of "timevar.h". (cp_parser_explicit_instantiation): Add push/pop calls to TV_TEMPLATE_INST. (cp_parser_enum_specifier): Add push/pop calls to new TV_PARSE_ENUM. (cp_parser_class_specifier): Add wrapper to add push/pop calls to TV_PARSE_STRUCT. (cp_parser_function_definition_from_specifiers_and_declarator): Add push/pop calls to new TV_PARSE_FUNC or TV_PARSE_INLINE. (cp_parser_late_parsing_for_member): Add push/pop calls to new TV_PARSE_INMETH. * call.c: Add include of "timevar.h". (convert_class_to_reference): Wrap and add push/pop calls to TV_OVERLOAD. (build_op_call): Likewise. (build_conditional_expr): Likewise. (build_new_op): Likewise. (build_new_method_call): Likewise. (build_user_type_conversion): Reorganize to single return and add push/pop calls to TV_OVERLOAD. (perform_overload_resolution): Likewise. * Make-lang.in: Add dependence of call.o and parser.o on $(TIMEVAR_H). From-SVN: r173277
117 lines
3.5 KiB
C
117 lines
3.5 KiB
C
/* Timing variables for measuring compiler performance.
|
|
Copyright (C) 2000, 2003, 2004, 2005, 2007, 2009, 2010
|
|
Free Software Foundation, Inc.
|
|
Contributed by Alex Samuel <samuel@codesourcery.com>
|
|
|
|
This file is part of GCC.
|
|
|
|
GCC is free software; you can redistribute it and/or modify it
|
|
under the terms of the GNU General Public License as published by
|
|
the Free Software Foundation; either version 3, or (at your option)
|
|
any later version.
|
|
|
|
GCC is distributed in the hope that it will be useful, but WITHOUT
|
|
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
|
or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
|
|
License for more details.
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
along with GCC; see the file COPYING3. If not see
|
|
<http://www.gnu.org/licenses/>. */
|
|
|
|
#ifndef GCC_TIMEVAR_H
|
|
#define GCC_TIMEVAR_H
|
|
|
|
/* Timing variables are used to measure elapsed time in various
|
|
portions of the compiler. Each measures elapsed user, system, and
|
|
wall-clock time, as appropriate to and supported by the host
|
|
system.
|
|
|
|
Timing variables are defined using the DEFTIMEVAR macro in
|
|
timevar.def. Each has an enumeral identifier, used when referring
|
|
to the timing variable in code, and a character string name.
|
|
|
|
Timing variables can be used in two ways:
|
|
|
|
- On the timing stack, using timevar_push and timevar_pop.
|
|
Timing variables may be pushed onto the stack; elapsed time is
|
|
attributed to the topmost timing variable on the stack. When
|
|
another variable is pushed on, the previous topmost variable is
|
|
`paused' until the pushed variable is popped back off.
|
|
|
|
- As a standalone timer, using timevar_start and timevar_stop.
|
|
All time elapsed between the two calls is attributed to the
|
|
variable.
|
|
*/
|
|
|
|
/* This structure stores the various varieties of time that can be
|
|
measured. Times are stored in seconds. The time may be an
|
|
absolute time or a time difference; in the former case, the time
|
|
base is undefined, except that the difference between two times
|
|
produces a valid time difference. */
|
|
|
|
struct timevar_time_def
|
|
{
|
|
/* User time in this process. */
|
|
double user;
|
|
|
|
/* System time (if applicable for this host platform) in this
|
|
process. */
|
|
double sys;
|
|
|
|
/* Wall clock time. */
|
|
double wall;
|
|
|
|
/* Garbage collector memory. */
|
|
unsigned ggc_mem;
|
|
};
|
|
|
|
/* An enumeration of timing variable identifiers. Constructed from
|
|
the contents of timevar.def. */
|
|
|
|
#define DEFTIMEVAR(identifier__, name__) \
|
|
identifier__,
|
|
typedef enum
|
|
{
|
|
TV_NONE,
|
|
#include "timevar.def"
|
|
TIMEVAR_LAST
|
|
}
|
|
timevar_id_t;
|
|
#undef DEFTIMEVAR
|
|
|
|
/* True if timevars should be used. In GCC, this happens with
|
|
the -ftime-report flag. */
|
|
extern bool timevar_enable;
|
|
|
|
/* Total amount of memory allocated by garbage collector. */
|
|
extern size_t timevar_ggc_mem_total;
|
|
|
|
extern void timevar_init (void);
|
|
extern void timevar_push_1 (timevar_id_t);
|
|
extern void timevar_pop_1 (timevar_id_t);
|
|
extern void timevar_start (timevar_id_t);
|
|
extern void timevar_stop (timevar_id_t);
|
|
extern bool timevar_cond_start (timevar_id_t);
|
|
extern void timevar_cond_stop (timevar_id_t, bool);
|
|
extern void timevar_print (FILE *);
|
|
|
|
/* Provided for backward compatibility. */
|
|
static inline void
|
|
timevar_push (timevar_id_t tv)
|
|
{
|
|
if (timevar_enable)
|
|
timevar_push_1 (tv);
|
|
}
|
|
|
|
static inline void
|
|
timevar_pop (timevar_id_t tv)
|
|
{
|
|
if (timevar_enable)
|
|
timevar_pop_1 (tv);
|
|
}
|
|
|
|
extern void print_time (const char *, long);
|
|
|
|
#endif /* ! GCC_TIMEVAR_H */
|