GCC Middle and Back End API Reference
timer Class Reference

#include <timevar.h>

Collaboration diagram for timer:

Data Structures

class  named_items
 
struct  timevar_def
 
struct  timevar_stack_def
 

Public Member Functions

 timer ()
 
 ~timer ()
 
void start (timevar_id_t tv)
 
void stop (timevar_id_t tv)
 
void push (timevar_id_t tv)
 
void pop (timevar_id_t tv)
 
bool cond_start (timevar_id_t tv)
 
void cond_stop (timevar_id_t tv)
 
void push_client_item (const char *item_name)
 
void pop_client_item ()
 
void print (FILE *fp)
 
json::valuemake_json () const
 
const charget_topmost_item_name () const
 

Private Types

typedef hash_map< timevar_def *, timevar_time_defchild_map_t
 

Private Member Functions

void validate_phases (FILE *fp) const
 
void push_internal (struct timevar_def *tv)
 
void pop_internal ()
 

Static Private Member Functions

static void print_row (FILE *fp, const timevar_time_def *total, const char *name, const timevar_time_def &elapsed)
 
static bool all_zero (const timevar_time_def &elapsed)
 

Private Attributes

timevar_def m_timevars [TIMEVAR_LAST]
 
timevar_stack_defm_stack
 
timevar_stack_defm_unused_stack_instances
 
timevar_time_def m_start_time
 
named_itemsm_jit_client_items
 

Friends

class named_items
 

Detailed Description

The public (within GCC) interface for timing.   

Member Typedef Documentation

◆ child_map_t

Constructor & Destructor Documentation

◆ timer()

timer::timer ( )
Class timer's constructor.   

References ggc_alloc(), and m_timevars.

◆ ~timer()

timer::~timer ( )

Member Function Documentation

◆ all_zero()

bool timer::all_zero ( const timevar_time_def & elapsed)
staticprivate

◆ cond_start()

bool timer::cond_start ( timevar_id_t timevar)
See timevar_cond_start above.   

References get_time(), ggc_alloc(), and m_timevars.

Referenced by auto_cond_timevar::start(), and timevar_cond_start().

◆ cond_stop()

void timer::cond_stop ( timevar_id_t timevar)

◆ get_topmost_item_name()

const char * timer::get_topmost_item_name ( ) const
Get the name of the topmost item.  For use by jit for validating
inputs to gcc_jit_timer_pop.   

References m_stack, timer::timevar_def::name, NULL, and timer::timevar_stack_def::timevar.

◆ make_json()

json::value * timer::make_json ( ) const

◆ pop()

void timer::pop ( timevar_id_t timevar)
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 gcc_assert, m_stack, m_timevars, pop_internal(), and timer::timevar_stack_def::timevar.

Referenced by timevar_pop(), and auto_timevar::~auto_timevar().

◆ pop_client_item()

void timer::pop_client_item ( )
Pop the top-most client item from the timing stack.   

References gcc_assert, m_jit_client_items, and timer::named_items::pop().

◆ pop_internal()

void timer::pop_internal ( )
private
Pop the topmost item from the stack, either one of the builtin ones
for a timevar_id_t, or one provided by client code to libgccjit.   

References timer::timevar_def::children, hash_map< KeyId, Value, Traits >::get_or_insert(), get_time(), ggc_alloc(), m_stack, m_start_time, m_unused_stack_instances, timer::timevar_stack_def::next, timer::timevar_stack_def::timevar, and timevar_accumulate().

Referenced by pop().

◆ print()

void timer::print ( FILE * fp)
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 all_zero(), timer::timevar_def::elapsed, get_time(), ggc_alloc(), timevar_time_def::ggc_mem, i, m_jit_client_items, m_stack, m_start_time, m_timevars, nanosec_to_floating_sec, timer::named_items::print(), print_row(), PRsa, SIZE_AMOUNT, timevar_time_def::sys, timer::timevar_stack_def::timevar, timevar_accumulate(), TIMEVAR_LAST, timevar_time_def::user, validate_phases(), and timevar_time_def::wall.

Referenced by toplev::~toplev().

◆ print_row()

void timer::print_row ( FILE * fp,
const timevar_time_def * total,
const char * name,
const timevar_time_def & elapsed )
staticprivate

◆ push()

void timer::push ( timevar_id_t timevar)
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 ggc_alloc(), m_timevars, and push_internal().

Referenced by auto_timevar::auto_timevar(), auto_timevar::auto_timevar(), and timevar_push().

◆ push_client_item()

void timer::push_client_item ( const char * item_name)
Push the named item onto the timing stack.   

References gcc_assert, ggc_alloc(), m_jit_client_items, named_items, and timer::named_items::push().

◆ push_internal()

void timer::push_internal ( struct timevar_def * tv)
private
Push TV onto the timing stack, either one of the builtin ones
for a timevar_id_t, or one provided by client code to libgccjit.   

References timer::timevar_def::elapsed, gcc_assert, get_time(), ggc_alloc(), m_stack, m_start_time, m_unused_stack_instances, timer::timevar_stack_def::next, NULL, timer::timevar_stack_def::timevar, and timevar_accumulate().

Referenced by push().

◆ start()

void timer::start ( timevar_id_t timevar)
See timevar_start above.   

References gcc_assert, get_time(), ggc_alloc(), and m_timevars.

Referenced by timevar_start().

◆ stop()

void timer::stop ( timevar_id_t timevar)
See timevar_stop above.   

References gcc_assert, get_time(), ggc_alloc(), m_timevars, and timevar_accumulate().

Referenced by timevar_stop(), and toplev::~toplev().

◆ validate_phases()

void timer::validate_phases ( FILE * fp) const
private

Friends And Related Symbol Documentation

◆ named_items

friend class named_items
friend

Referenced by push_client_item().

Field Documentation

◆ m_jit_client_items

named_items* timer::m_jit_client_items
private

◆ m_stack

◆ m_start_time

timevar_time_def timer::m_start_time
private

Referenced by pop_internal(), print(), and push_internal().

◆ m_timevars

◆ m_unused_stack_instances

timevar_stack_def* timer::m_unused_stack_instances
private

Referenced by pop_internal(), push_internal(), and ~timer().


The documentation for this class was generated from the following files: