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 char * get_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 m_timevars.

◆ ~timer()

timer::~timer ( )

Member Function Documentation

◆ all_zero()

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

◆ cond_start()

◆ cond_stop()

◆ 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()

◆ 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, timer::timevar_def::elapsed, hash_map< KeyId, Value, Traits >::get_or_insert(), get_time(), 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()

◆ 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 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, 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(), m_stack, m_start_time, m_unused_stack_instances, timer::timevar_stack_def::next, NULL, timer::timevar_def::standalone, timer::timevar_stack_def::timevar, timevar_accumulate(), and timer::timevar_def::used.

Referenced by push().

◆ start()

void timer::start ( timevar_id_t timevar)

◆ stop()

◆ 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: