Jlm
Classes | Public Types | Public Member Functions | Protected Member Functions | Private Attributes | List of all members
jlm::util::Statistics Class Reference

Statistics Interface. More...

#include <Statistics.hpp>

Inheritance diagram for jlm::util::Statistics:
Inheritance graph
[legend]
Collaboration diagram for jlm::util::Statistics:
Collaboration graph
[legend]

Classes

struct  Label
 

Public Types

enum class  Id {
  FirstEnumValue , Aggregation , AgnosticModRefSummarizer , AliasAnalysisPrecisionEvaluation ,
  AndersenAnalysis , Annotation , CommonNodeElimination , ControlFlowRecovery ,
  DataNodeToDelta , DeadNodeElimination , FunctionInlining , IfConversion ,
  InvariantValueRedirection , JlmToRvsdgConversion , LoopUnrolling , LoopUnswitching ,
  MemoryStateEncoder , PullNodes , PushNodes , ReduceNodes ,
  RegionAwareModRefSummarizer , RvsdgConstruction , RvsdgDestruction , RvsdgOptimization ,
  RvsdgTreePrinter , ScalarEvolution , LastEnumValue
}
 
using Measurement = std::variant< std::string, int64_t, uint64_t, double >
 
using MeasurementList = std::list< std::pair< std::string, Measurement > >
 
using TimerList = std::list< std::pair< std::string, util::Timer > >
 

Public Member Functions

virtual ~Statistics ()
 
 Statistics (const Statistics::Id &statisticsId, util::FilePath sourceFile)
 
Statistics::Id GetId () const noexcept
 
std::string_view GetName () const
 
const util::FilePathGetSourceFile () const
 
std::string Serialize (char fieldSeparator, char nameValueSeparator) const
 
bool HasMeasurement (const std::string &name) const noexcept
 
const MeasurementGetMeasurement (const std::string &name) const
 
template<typename T >
const T & GetMeasurementValue (const std::string &name) const
 
IteratorRange< MeasurementList::const_iterator > GetMeasurements () const
 
bool HasTimer (const std::string &name) const noexcept
 
size_t GetTimerElapsedNanoseconds (const std::string &name) const
 
IteratorRange< TimerList::const_iterator > GetTimers () const
 

Protected Member Functions

template<typename T >
void AddMeasurement (std::string name, T value)
 
util::TimerAddTimer (std::string name)
 
util::TimerGetTimer (const std::string &name)
 
const util::TimerGetTimer (const std::string &name) const
 

Private Attributes

Statistics::Id StatisticsId_
 
util::FilePath SourceFile_
 
MeasurementList Measurements_
 
TimerList Timers_
 

Detailed Description

Statistics Interface.

Definition at line 30 of file Statistics.hpp.

Member Typedef Documentation

◆ Measurement

using jlm::util::Statistics::Measurement = std::variant<std::string, int64_t, uint64_t, double>

Definition at line 66 of file Statistics.hpp.

◆ MeasurementList

using jlm::util::Statistics::MeasurementList = std::list<std::pair<std::string, Measurement> >

Definition at line 68 of file Statistics.hpp.

◆ TimerList

using jlm::util::Statistics::TimerList = std::list<std::pair<std::string, util::Timer> >

Definition at line 69 of file Statistics.hpp.

Member Enumeration Documentation

◆ Id

Enumerator
FirstEnumValue 
Aggregation 
AgnosticModRefSummarizer 
AliasAnalysisPrecisionEvaluation 
AndersenAnalysis 
Annotation 
CommonNodeElimination 
ControlFlowRecovery 
DataNodeToDelta 
DeadNodeElimination 
FunctionInlining 
IfConversion 
InvariantValueRedirection 
JlmToRvsdgConversion 
LoopUnrolling 
LoopUnswitching 
MemoryStateEncoder 
PullNodes 
PushNodes 
ReduceNodes 
RegionAwareModRefSummarizer 
RvsdgConstruction 
RvsdgDestruction 
RvsdgOptimization 
RvsdgTreePrinter 
ScalarEvolution 
LastEnumValue 

Definition at line 33 of file Statistics.hpp.

Constructor & Destructor Documentation

◆ ~Statistics()

jlm::util::Statistics::~Statistics ( )
virtualdefault

◆ Statistics()

jlm::util::Statistics::Statistics ( const Statistics::Id statisticsId,
util::FilePath  sourceFile 
)
inline

Definition at line 73 of file Statistics.hpp.

Member Function Documentation

◆ AddMeasurement()

template<typename T >
void jlm::util::Statistics::AddMeasurement ( std::string  name,
value 
)
inlineprotected

Adds a measurement, identified by name, with the given value. Requires that the measurement doesn't already exist.

Template Parameters
Tthe type of the measurement, must be one of: std::string, int64_t, uint64_t, double

Definition at line 174 of file Statistics.hpp.

◆ AddTimer()

util::Timer & jlm::util::Statistics::AddTimer ( std::string  name)
protected

Creates a new timer with the given name. Requires that the timer does not already exist.

Returns
a reference to the timer

Definition at line 155 of file Statistics.cpp.

◆ GetId()

Statistics::Id jlm::util::Statistics::GetId ( ) const
inlinenoexcept

Definition at line 79 of file Statistics.hpp.

◆ GetMeasurement()

const Statistics::Measurement & jlm::util::Statistics::GetMeasurement ( const std::string &  name) const

Gets the measurement with the given name, it must exist.

Returns
a reference to the measurement.

Definition at line 110 of file Statistics.cpp.

◆ GetMeasurements()

IteratorRange< Statistics::MeasurementList::const_iterator > jlm::util::Statistics::GetMeasurements ( ) const

Retrieves the full list of measurements

Definition at line 119 of file Statistics.cpp.

◆ GetMeasurementValue()

template<typename T >
const T& jlm::util::Statistics::GetMeasurementValue ( const std::string &  name) const
inline

Gets the value of the measurement with the given name. Requires the measurement to exist and have the given type

Template Parameters
T.
Returns
the measurement's value.

Definition at line 130 of file Statistics.hpp.

◆ GetName()

std::string_view jlm::util::Statistics::GetName ( ) const
Returns
a string identifying the type of this Statistics instance

Definition at line 57 of file Statistics.cpp.

◆ GetSourceFile()

const util::FilePath & jlm::util::Statistics::GetSourceFile ( ) const
Returns
the source file that was worked on while capturing these statistics

Definition at line 63 of file Statistics.cpp.

◆ GetTimer() [1/2]

util::Timer & jlm::util::Statistics::GetTimer ( const std::string &  name)
protected

Retrieves the timer with the given name. Requires that the timer already exists.

Returns
a reference to the timer

Definition at line 134 of file Statistics.cpp.

◆ GetTimer() [2/2]

const util::Timer & jlm::util::Statistics::GetTimer ( const std::string &  name) const
protected

Definition at line 143 of file Statistics.cpp.

◆ GetTimerElapsedNanoseconds()

size_t jlm::util::Statistics::GetTimerElapsedNanoseconds ( const std::string &  name) const
inline

Retrieves the measured time passed on the timer with the given name. Requires the timer to exist, and not currently be running.

Returns
the timer's elapsed time in nanoseconds

Definition at line 155 of file Statistics.hpp.

◆ GetTimers()

IteratorRange< Statistics::TimerList::const_iterator > jlm::util::Statistics::GetTimers ( ) const

Retrieves the full list of timers

Definition at line 149 of file Statistics.cpp.

◆ HasMeasurement()

bool jlm::util::Statistics::HasMeasurement ( const std::string &  name) const
noexcept

Checks if a measurement with the given name exists.

Returns
true if the measurement exists, false otherwise.

Definition at line 101 of file Statistics.cpp.

◆ HasTimer()

bool jlm::util::Statistics::HasTimer ( const std::string &  name) const
noexcept

Checks if a timer with the given name exists.

Returns
true if the timer exists, false otherwise.

Definition at line 125 of file Statistics.cpp.

◆ Serialize()

std::string jlm::util::Statistics::Serialize ( char  fieldSeparator,
char  nameValueSeparator 
) const

Converts the Statistics instance to a string containing all information it has. Requires all timers to be stopped.

Parameters
fieldSeparatorSeparation character used between different measurements and/or timers.
nameValueSeparatorSeparation character used between the name and value of a measurement or timer.
Returns
a full serialized description of the Statistic instance

Definition at line 69 of file Statistics.cpp.

Member Data Documentation

◆ Measurements_

MeasurementList jlm::util::Statistics::Measurements_
private

Definition at line 247 of file Statistics.hpp.

◆ SourceFile_

util::FilePath jlm::util::Statistics::SourceFile_
private

Definition at line 245 of file Statistics.hpp.

◆ StatisticsId_

Statistics::Id jlm::util::Statistics::StatisticsId_
private

Definition at line 244 of file Statistics.hpp.

◆ Timers_

TimerList jlm::util::Statistics::Timers_
private

Definition at line 248 of file Statistics.hpp.


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