GCC Middle and Back End API Reference
timevar.h File Reference
#include "timevar.def"
Include dependency graph for timevar.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  timevar_time_def
 
class  timer
 
struct  timer::timevar_def
 
struct  timer::timevar_stack_def
 
class  auto_timevar
 
class  auto_cond_timevar
 

Namespaces

namespace  json
 

Macros

#define DEFTIMEVAR(identifier__, name__)
 

Enumerations

enum  timevar_id_t { TV_NONE , TIMEVAR_LAST }
 

Functions

void timevar_init (void)
 
void timevar_start (timevar_id_t)
 
void timevar_stop (timevar_id_t)
 
bool timevar_cond_start (timevar_id_t)
 
void timevar_cond_stop (timevar_id_t, bool)
 
void timevar_push (timevar_id_t tv)
 
void timevar_pop (timevar_id_t tv)
 
void print_time (const char *, long)
 

Variables

timerg_timer
 
size_t timevar_ggc_mem_total
 

Macro Definition Documentation

◆ DEFTIMEVAR

#define DEFTIMEVAR ( identifier__,
name__ )
Value:
identifier__,
An enumeration of timing variable identifiers.  Constructed from
the contents of timevar.def.   

Enumeration Type Documentation

◆ timevar_id_t

Enumerator
TV_NONE 
TIMEVAR_LAST 
This file contains the definitions for timing variables used to
measure run-time performance of the compiler.
Copyright (C) 2000-2024 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/>.   
This file contains timing variable definitions, used by timevar.h
and timevar.cc.

Syntax:

  DEFTIMEVAR (id, name)

where ID is the enumeral value used to identify the timing
variable, and NAME is a character string describing its purpose.   
The total execution time.   
The compiler phases.

These must be mutually exclusive, and the NAME field must begin
with "phase".

Also, their sum must be within a millionth of the total time (see
validate_phases).   
Concurrent timers, indicated by "|".   
Time spent garbage-collecting.   
Time spent generating dump files.   
Time spent saving/restoring PCH state.   
Time spent by constructing CFG.   
Time spent by cleaning up CFG.   
Time spent in dataflow problems.   
Timing in various stages of the compiler.   
Everything else in rest_of_compilation not included above.   
Stuff used by libgccjit.so.   
Analyzer timevars.   

Function Documentation

◆ print_time()

void print_time ( const char * str,
long total )
extern
Prints a message to stderr stating that time elapsed in STR is
TOTAL (given in microseconds).   

References all_time.

◆ timevar_cond_start()

bool timevar_cond_start ( timevar_id_t timevar)
extern
Conditionally start timing TIMEVAR independently of the timing stack.
If the timer is already running, leave it running and return true.
Otherwise, start the timer and return false.
Elapsed time until the corresponding timevar_cond_stop
is called for the same timing variable is attributed to TIMEVAR.   

References timer::cond_start(), and g_timer.

◆ timevar_cond_stop()

void timevar_cond_stop ( timevar_id_t timevar,
bool running )
extern
Conditionally stop timing TIMEVAR.  The RUNNING parameter must come
from the return value of a dynamically matching timevar_cond_start.
If the timer had already been RUNNING, do nothing.  Otherwise, time
elapsed since timevar_cond_start was called is attributed to it.   

References timer::cond_stop(), and g_timer.

◆ timevar_init()

void timevar_init ( void )
extern
Initialize timing variables.   

References g_timer.

Referenced by toplev::start_timevars().

◆ timevar_pop()

void timevar_pop ( timevar_id_t tv)
inline

References g_timer, and timer::pop().

Referenced by build_type_inheritance_graph(), calculate_dominance_info(), calculate_dominance_info_for_region(), cleanup_cfg(), cleanup_tree_cfg_noloop(), symbol_table::compile(), compile_file(), compute_dominance_frontiers(), compute_points_to_sets(), control_dependences::control_dependences(), create_new_def_for(), delete_trivially_dead_insns(), df_analyze_problem(), do_reload(), early_inliner(), execute_ipa_stmt_fixups(), execute_ipa_summary_passes(), execute_one_ipa_transform_pass(), execute_one_pass(), execute_update_addresses_taken(), cgraph_node::expand(), symbol_table::finalize_compilation_unit(), gcc::pass_manager::finish_optimization_passes(), fix_loop_structure(), varpool_node::get_constructor(), cgraph_node::get_untransformed_body(), ggc_collect(), ggc_trim(), gimplify_body(), gt_pch_save(), indirect_jump_optimize(), init_alias_analysis(), initialize_plugins(), inline_transform(), invoke_plugin_callbacks_full(), ipa_read_optimization_summaries_1(), ipa_read_summaries_1(), ipa_write_optimization_summaries_1(), ipa_write_summaries_2(), iterate_fix_dominators(), lang_dependent_init(), lhd_append_data(), loop_optimizer_finalize(), loop_optimizer_init(), lra(), lra_assign(), lra_coalesce(), lra_create_live_ranges_1(), lra_eliminate(), lra_inheritance(), lra_remat(), lto_compression_zlib(), lto_uncompression_zlib(), output_constructor(), symbol_table::output_variables(), pass_fini_dump_file(), pass_init_dump_file(), possible_polymorphic_call_targets(), rebuild_jump_labels_1(), reg_scan(), regstat_compute_calls_crossed(), regstat_compute_ri(), regstat_init_n_sets_and_refs(), symbol_table::remove_unreachable_nodes(), remove_unused_locals(), repair_loop_structures(), rest_of_decl_compilation(), rest_of_handle_combine(), rest_of_handle_cse(), rest_of_handle_cse2(), rest_of_handle_cse_after_global_opts(), rest_of_handle_final(), rest_of_type_compilation(), run_word_dce(), tail_merge_optimize(), update_ssa(), update_stmt_operands(), update_type_inheritance_graph(), variable_tracking_main_1(), symtab_node::verify(), verify_flow_info(), verify_gimple_in_cfg(), verify_gimple_in_seq(), verify_loop_closed_ssa(), cgraph_node::verify_node(), verify_rtl_sharing(), verify_ssa(), vt_find_locations(), walk_aliased_vdefs(), walk_non_aliased_vuses(), and write_lto().

◆ timevar_push()

void timevar_push ( timevar_id_t tv)
inline
Provided for backward compatibility.   

References g_timer, and timer::push().

Referenced by build_type_inheritance_graph(), calculate_dominance_info(), calculate_dominance_info_for_region(), cleanup_cfg(), cleanup_tree_cfg_noloop(), symbol_table::compile(), compile_file(), compute_dominance_frontiers(), compute_points_to_sets(), control_dependences::control_dependences(), create_new_def_for(), delete_trivially_dead_insns(), df_analyze_problem(), do_reload(), early_inliner(), execute_ipa_stmt_fixups(), execute_ipa_summary_passes(), execute_one_ipa_transform_pass(), execute_one_pass(), execute_update_addresses_taken(), cgraph_node::expand(), symbol_table::finalize_compilation_unit(), gcc::pass_manager::finish_optimization_passes(), fix_loop_structure(), varpool_node::get_constructor(), cgraph_node::get_untransformed_body(), ggc_collect(), ggc_trim(), gimplify_body(), gt_pch_save(), indirect_jump_optimize(), init_alias_analysis(), initialize_plugins(), inline_transform(), invoke_plugin_callbacks_full(), ipa_read_optimization_summaries_1(), ipa_read_summaries_1(), ipa_write_optimization_summaries_1(), ipa_write_summaries_2(), iterate_fix_dominators(), lang_dependent_init(), lhd_append_data(), loop_optimizer_finalize(), loop_optimizer_init(), lra(), lra_assign(), lra_coalesce(), lra_create_live_ranges_1(), lra_eliminate(), lra_inheritance(), lra_remat(), lto_compression_zlib(), lto_uncompression_zlib(), output_constructor(), symbol_table::output_variables(), pass_fini_dump_file(), pass_init_dump_file(), possible_polymorphic_call_targets(), rebuild_jump_labels_1(), reg_scan(), regstat_compute_calls_crossed(), regstat_compute_ri(), regstat_init_n_sets_and_refs(), symbol_table::remove_unreachable_nodes(), remove_unused_locals(), repair_loop_structures(), rest_of_decl_compilation(), rest_of_handle_combine(), rest_of_handle_cse(), rest_of_handle_cse2(), rest_of_handle_cse_after_global_opts(), rest_of_handle_final(), rest_of_type_compilation(), run_word_dce(), tail_merge_optimize(), update_ssa(), update_stmt_operands(), update_type_inheritance_graph(), variable_tracking_main_1(), symtab_node::verify(), verify_flow_info(), verify_gimple_in_cfg(), verify_gimple_in_seq(), verify_loop_closed_ssa(), cgraph_node::verify_node(), verify_rtl_sharing(), verify_ssa(), vt_find_locations(), walk_aliased_vdefs(), walk_non_aliased_vuses(), and write_lto().

◆ timevar_start()

void timevar_start ( timevar_id_t timevar)
extern
Start timing TIMEVAR independently of the timing stack.  Elapsed
time until timevar_stop is called for the same timing variable is
attributed to TIMEVAR.   

References g_timer, and timer::start().

Referenced by symbol_table::compile(), compile_file(), do_compile(), global_decl_processing(), and toplev::start_timevars().

◆ timevar_stop()

void timevar_stop ( timevar_id_t timevar)
extern
Stop timing TIMEVAR.  Time elapsed since timevar_start was called
is attributed to it.   

References g_timer, and timer::stop().

Referenced by symbol_table::compile(), compile_file(), do_compile(), and global_decl_processing().

Variable Documentation

◆ g_timer

timer* g_timer
extern
The singleton instance of timing state.

This is non-NULL if timevars should be used.  In GCC, this happens with
the -ftime-report flag.  Hence this is NULL for the common,
needs-to-be-fast case, with an early reject happening for this being
NULL.   
Non-NULL if timevars should be used.  In GCC, this happens with
the -ftime-report flag.   

Referenced by compiler_data_hooks::add_sarif_invocation_properties(), initialize_rtl(), timevar_cond_start(), timevar_cond_stop(), timevar_init(), timevar_pop(), timevar_push(), timevar_start(), timevar_stop(), toplev::toplev(), and toplev::~toplev().

◆ timevar_ggc_mem_total

size_t timevar_ggc_mem_total
extern
Total amount of memory allocated by garbage collector.   

Referenced by get_time(), and ggc_internal_alloc().