Chi-Tech
chi::TimingBlock Class Reference

#include <TimingLog.h>

Public Member Functions

 TimingBlock (const std::string &name)
 
 TimingBlock (const TimingBlock &other)=delete
 
 TimingBlock (TimingBlock &&other)=delete
 
void TimeSectionBegin ()
 
void TimeSectionEnd ()
 
size_t NumberOfOccurences () const
 
double TotalTime () const
 
double AverageTime () const
 
double LastDelta () const
 
std::string MakeGraphString ()
 

Protected Member Functions

void AddChild (const TimingBlock &child_block)
 
void AppendGraphEntry (std::vector< std::vector< std::string > > &string_matrix, const TimingBlock *parent, const std::string &indent) const
 

Protected Attributes

const std::string name_
 
size_t num_occurences_ = 0
 
double total_time_ = 0.0
 
double reference_time_ = 0.0
 
double last_delta_time_ = 0.0
 
std::vector< const TimingBlock * > children_
 

Friends

class TimingLog
 

Detailed Description

Hierarchical timing block to efficiently capture timing.

Definition at line 42 of file TimingLog.h.

Constructor & Destructor Documentation

◆ TimingBlock() [1/3]

chi::TimingBlock::TimingBlock ( const std::string &  name)
explicit

Constructs the given block with the given name.

Definition at line 76 of file TimingLog.cc.

◆ TimingBlock() [2/3]

chi::TimingBlock::TimingBlock ( const TimingBlock other)
delete

Deleted copy constructor.

◆ TimingBlock() [3/3]

chi::TimingBlock::TimingBlock ( TimingBlock &&  other)
delete

Deleted move constructor.

Member Function Documentation

◆ AddChild()

void chi::TimingBlock::AddChild ( const TimingBlock child_block)
protected

Adds the supplied timing black as a child.

Definition at line 107 of file TimingLog.cc.

◆ AppendGraphEntry()

void chi::TimingBlock::AppendGraphEntry ( std::vector< std::vector< std::string > > &  string_matrix,
const TimingBlock parent,
const std::string &  indent 
) const
protected

Used when building the graph, this is a recursive function that adds each entry to a matrix.

Definition at line 197 of file TimingLog.cc.

◆ AverageTime()

double chi::TimingBlock::AverageTime ( ) const

Returns the average time per occurence.

Definition at line 95 of file TimingLog.cc.

◆ LastDelta()

double chi::TimingBlock::LastDelta ( ) const

Returns the last computed time differential.

Definition at line 102 of file TimingLog.cc.

◆ MakeGraphString()

std::string chi::TimingBlock::MakeGraphString ( )

Makes a string table of the timing block and all its children.

Lambda to left pad an entry.

Lambda to right pad an entry.

Definition at line 112 of file TimingLog.cc.

◆ NumberOfOccurences()

size_t chi::TimingBlock::NumberOfOccurences ( ) const

Returns the number of timing section occurrences.

Definition at line 91 of file TimingLog.cc.

◆ TimeSectionBegin()

void chi::TimingBlock::TimeSectionBegin ( )

Begins a timing section by resetting the reference time.

Definition at line 78 of file TimingLog.cc.

◆ TimeSectionEnd()

void chi::TimingBlock::TimeSectionEnd ( )

Ends a timing section, contributes to the total time and adds an occurrence.

Definition at line 83 of file TimingLog.cc.

◆ TotalTime()

double chi::TimingBlock::TotalTime ( ) const

Returns the computed total time over all occurrences.

Definition at line 93 of file TimingLog.cc.

Friends And Related Function Documentation

◆ TimingLog

friend class TimingLog
friend

Definition at line 71 of file TimingLog.h.

Field Documentation

◆ children_

std::vector<const TimingBlock*> chi::TimingBlock::children_
protected

Definition at line 85 of file TimingLog.h.

◆ last_delta_time_

double chi::TimingBlock::last_delta_time_ = 0.0
protected

Definition at line 84 of file TimingLog.h.

◆ name_

const std::string chi::TimingBlock::name_
protected

Definition at line 80 of file TimingLog.h.

◆ num_occurences_

size_t chi::TimingBlock::num_occurences_ = 0
protected

Definition at line 81 of file TimingLog.h.

◆ reference_time_

double chi::TimingBlock::reference_time_ = 0.0
protected

Definition at line 83 of file TimingLog.h.

◆ total_time_

double chi::TimingBlock::total_time_ = 0.0
protected

Definition at line 82 of file TimingLog.h.


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