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

clock_t clock ( void  )
static void get_time ( struct timevar_time_def )
static
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.  
int getrusage ( int  ,
struct rusage *   
)
void print_time ( )
   Prints a message to stderr stating that time elapsed in STR is
   TOTAL (given in microseconds).  
clock_t times ( struct tms )
   Prefer times to getrusage to clock (each gives successively less
   information).  
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.  

Referenced by timevar_init(), timevar_stop(), and validate_phases().

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.  
     Mark this timing variable as used.  
     Don't allow the same timing variable
     to be unconditionally started more than once.  

References timevar_def::elapsed, timevar_time_def::ggc_mem, timevar_def::name, timevar_time_def::sys, TIMEVAR_LAST, timevars, timevar_def::used, timevar_time_def::user, and timevar_time_def::wall.

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.  
     TIMEVAR must have been started via timevar_cond_start.  

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

void timevar_init ( void  )
   Initialize timing variables.  
     Zero all elapsed times.  
     Initialize the names of timing variables.  

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

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.  
     What time is it?  
     Attribute the elapsed time to the element we're popping.  
     Reset the start time; from now on, time is attributed to the
     element just exposed on the stack.  
     Take the item off the stack.  
     Don't delete the stack element; instead, add it to the list of
     unused elements for later use.  
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.  
     Only print stuff if we have some sort of time information.  
     Update timing information in case we're calling this from GDB.  
     What time is it?  
     If the stack isn't empty, attribute the current elapsed time to
     the old topmost element.  
     Reset the start time; from now on, time is attributed to
     TIMEVAR.  
         Don't print the total execution time here; that goes at the
         end.  
         Don't print timing variables that were never used.  
         Don't print timing variables if we're going to get a row of
         zeroes.  
         The timing variable name.  
         Print user-mode time for this process.  
         Print system-mode time for this process.  
         Print wall clock time elapsed.  
         Print the amount of ggc memory allocated.  
     Print total time.  
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.  
     Mark this timing variable as used.  
     Can't push a standalone timer.  
     What time is it?  
     If the stack isn't empty, attribute the current elapsed time to
     the old topmost element.  
     Reset the start time; from now on, time is attributed to
     TIMEVAR.  
     See if we have a previously-allocated stack instance.  If so,
     take it off the list.  If not, malloc a new one.  
     Fill it in and put it on the stack.  

References timevar_stack_def::next, and unused_stack_instances.

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.  
     Mark this timing variable as used.  
     Don't allow the same timing variable to be started more than
     once.  

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

Referenced by lhd_gimplify_expr().

void timevar_stop ( )
   Stop timing TIMEVAR.  Time elapsed since timevar_start was called
   is attributed to it.  
     TIMEVAR must have been started via timevar_start.  

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

static void validate_phases ( )
static

Variable Documentation

double clocks_to_msec
static
struct timevar_stack_def* stack
static
   The top of the timing stack.  

Referenced by dfs_next_edge(), insert_store(), and too_large().

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_init(), and validate_phases().

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?  
bool timevar_enable
   True if timevars should be used.  In GCC, this happens with
   the -ftime-report flag.  

Referenced by timevar_start(), timevar_stop(), and validate_phases().

size_t timevar_ggc_mem_total
   Total amount of memory allocated by garbage collector.  
struct timevar_def timevars[TIMEVAR_LAST]
static
   Declared timing variables.  Constructed from the contents of
   timevar.def.  

Referenced by timevar_cond_start(), timevar_init(), 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_push_1().