GCC Middle and Back End API Reference
timevar.c File Reference

Data Structures

struct  tms
struct  timevar_def
struct  timevar_stack_def

Typedefs

typedef int clock_t

Functions

clock_t times (struct tms *)
int getrusage (int, struct rusage *)
clock_t clock (void)
static void get_time (struct timevar_time_def *)
static void timevar_accumulate (struct timevar_time_def *, struct timevar_time_def *, struct timevar_time_def *)
static void get_time ()
void timevar_init ()
void timevar_push_1 ()
void timevar_pop_1 ()
void timevar_start ()
void timevar_stop ()
bool timevar_cond_start ()
void timevar_cond_stop ()
static void validate_phases ()
void timevar_print ()
void print_time ()

Variables

static double ticks_to_msec
static double clocks_to_msec
bool timevar_enable
size_t timevar_ggc_mem_total
static struct timevar_def timevars [TIMEVAR_LAST]
static struct timevar_stack_defstack
static struct timevar_stack_defunused_stack_instances
static struct timevar_time_def start_time

Typedef Documentation

typedef int clock_t
@verbatim Timing variables for measuring compiler performance.

Copyright (C) 2000-2013 Free Software Foundation, Inc. Contributed by Alex Samuel samue.nosp@m.l@co.nosp@m.desou.nosp@m.rcer.nosp@m.y.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/.


Function Documentation

static void get_time ( )
static
Fill the current times into TIME.  The definition of this function
   also defines any or all of the HAVE_USER_TIME, HAVE_SYS_TIME, and
   HAVE_WALL_TIME macros.   

References clock(), clocks_to_msec, getrusage(), timevar_time_def::ggc_mem, timevar_time_def::sys, ticks_to_msec, times(), timevar_enable, timevar_ggc_mem_total, tms::tms_stime, tms::tms_utime, timevar_time_def::user, and timevar_time_def::wall.

int getrusage ( int  ,
struct rusage *   
)

Referenced by get_time().

void print_time ( )
Prints a message to stderr stating that time elapsed in STR is
   TOTAL (given in microseconds).   

References all_time.

clock_t times ( struct tms )
Prefer times to getrusage to clock (each gives successively less
   information).   

Referenced by dump_expr_1(), dump_ggc_loc_statistics(), dump_vec_loc_statistics(), execute(), and get_time().

static void timevar_accumulate ( struct timevar_time_def timer,
struct timevar_time_def start_time,
struct timevar_time_def stop_time 
)
static
Add the difference between STOP_TIME and START_TIME to TIMER.   

References timevar_time_def::ggc_mem, timevar_time_def::sys, timevar_time_def::user, and timevar_time_def::wall.

Referenced by timevar_cond_stop(), timevar_pop_1(), timevar_print(), timevar_push_1(), and timevar_stop().

bool timevar_cond_start ( )
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 get_time(), timevar_def::standalone, timevar_def::start_time, timevar_enable, timevars, and timevar_def::used.

void timevar_cond_stop ( )
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 timevar_def::elapsed, get_time(), timevar_def::standalone, timevar_def::start_time, timevar_accumulate(), timevar_enable, and timevars.

void timevar_init ( void  )
Initialize timing variables.   

References clocks_to_msec, memset(), ticks_to_msec, timevar_enable, and timevars.

Referenced by do_compile().

void timevar_pop_1 ( )
Pop the topmost timing variable element off the timing stack.  The
   popped variable must be TIMEVAR.  Elapsed time since the that
   element was pushed on, or since it was last exposed on top of the
   stack when the element above it was popped off, is credited to that
   timing variable.   

References timevar_def::elapsed, get_time(), timevar_stack_def::next, stack, start_time, timevar_stack_def::timevar, timevar_accumulate(), timevars, and unused_stack_instances.

Referenced by timevar_pop().

void timevar_print ( )
Summarize timing variables to FP.  The timing variable TV_TOTAL has
   a special meaning -- it's considered to be the total elapsed time,
   for normalizing the others, and is displayed last.   

References timevar_def::elapsed, get_time(), timevar_time_def::ggc_mem, timevar_def::name, start_time, timevar_time_def::sys, timevar_stack_def::timevar, timevar_accumulate(), timevar_enable, TIMEVAR_LAST, timevars, timevar_def::used, timevar_time_def::user, validate_phases(), and timevar_time_def::wall.

Referenced by do_compile().

void timevar_push_1 ( )
Push TIMEVAR onto the timing stack.  No further elapsed time is
   attributed to the previous topmost timing variable on the stack;
   subsequent elapsed time is attributed to TIMEVAR, until it is
   popped or another element is pushed on top.

   TIMEVAR cannot be running as a standalone timer.   

References timevar_def::elapsed, get_time(), timevar_stack_def::next, stack, timevar_def::standalone, start_time, timevar_stack_def::timevar, timevar_accumulate(), timevars, unused_stack_instances, and timevar_def::used.

Referenced by timevar_push().

void timevar_start ( )
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 get_time(), timevar_def::standalone, timevar_def::start_time, timevar_enable, timevars, and timevar_def::used.

Referenced by compile_file(), do_compile(), and write_global_declarations().

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

References timevar_def::elapsed, get_time(), timevar_def::standalone, timevar_def::start_time, timevar_accumulate(), timevar_enable, and timevars.

Referenced by compile_file(), do_compile(), and write_global_declarations().

static void validate_phases ( )
static

Variable Documentation

double clocks_to_msec
static

Referenced by get_time(), and timevar_init().

struct timevar_time_def start_time
static
The time at which the topmost element on the timing stack was
   pushed.  Time elapsed since then is attributed to the topmost
   element.   

Referenced by timevar_pop_1(), timevar_print(), and timevar_push_1().

double ticks_to_msec
static
libc is very likely to have snuck a call to sysconf() into one of
   the underlying constants, and that can be very slow, so we have to
   precompute them.  Whose wonderful idea was it to make all those
   _constants_ variable at run time, anyway?   

Referenced by get_time(), and timevar_init().

bool timevar_enable
True if timevars should be used.  In GCC, this happens with
   the -ftime-report flag.   

Referenced by get_time(), timevar_cond_start(), timevar_cond_stop(), timevar_init(), timevar_pop(), timevar_print(), timevar_push(), timevar_start(), and timevar_stop().

size_t timevar_ggc_mem_total
Total amount of memory allocated by garbage collector.   

Referenced by get_time(), and ggc_internal_alloc_stat().

struct timevar_def timevars[TIMEVAR_LAST]
static
Declared timing variables.  Constructed from the contents of
   timevar.def.   

Referenced by timevar_cond_start(), timevar_cond_stop(), timevar_init(), timevar_pop_1(), timevar_print(), timevar_push_1(), timevar_start(), timevar_stop(), and validate_phases().

struct timevar_stack_def* unused_stack_instances
static
A list of unused (i.e. allocated and subsequently popped)
   timevar_stack_def instances.   

Referenced by timevar_pop_1(), and timevar_push_1().