Google OR-Tools v9.11
a fast and portable software suite for combinatorial optimization
Loading...
Searching...
No Matches
operations_research::StatsGroup Class Reference

Base class to print a nice summary of a group of statistics. More...

#include <stats.h>

Public Types

enum  PrintOrder { SORT_BY_PRIORITY_THEN_VALUE = 0 , SORT_BY_NAME = 1 }
 

Public Member Functions

 StatsGroup (absl::string_view name)
 
 StatsGroup (const StatsGroup &)=delete
 This type is neither copyable nor movable.
 
StatsGroupoperator= (const StatsGroup &)=delete
 
 ~StatsGroup ()
 
void Register (Stat *stat)
 
std::string StatString () const
 
void SetPrintOrder (PrintOrder print_order)
 
TimeDistributionLookupOrCreateTimeDistribution (std::string name)
 
void Reset ()
 Calls Reset() on all the statistics registered with this group.
 

Detailed Description

Base class to print a nice summary of a group of statistics.

Definition at line 128 of file stats.h.

Member Enumeration Documentation

◆ PrintOrder

Enumerator
SORT_BY_PRIORITY_THEN_VALUE 
SORT_BY_NAME 

Definition at line 130 of file stats.h.

Constructor & Destructor Documentation

◆ StatsGroup() [1/2]

operations_research::StatsGroup::StatsGroup ( absl::string_view name)
inlineexplicit

Definition at line 135 of file stats.h.

◆ StatsGroup() [2/2]

operations_research::StatsGroup::StatsGroup ( const StatsGroup & )
delete

This type is neither copyable nor movable.

◆ ~StatsGroup()

operations_research::StatsGroup::~StatsGroup ( )

Definition at line 54 of file stats.cc.

Member Function Documentation

◆ LookupOrCreateTimeDistribution()

TimeDistribution * operations_research::StatsGroup::LookupOrCreateTimeDistribution ( std::string name)

Returns and if needed creates and registers a TimeDistribution with the given name. Note that this involve a map lookup and his thus slower than directly accessing a TimeDistribution variable.

Definition at line 120 of file stats.cc.

◆ operator=()

StatsGroup & operations_research::StatsGroup::operator= ( const StatsGroup & )
delete

◆ Register()

void operations_research::StatsGroup::Register ( Stat * stat)

Registers a Stat, which will appear in the string returned by StatString(). The Stat object must live as long as this StatsGroup.

Definition at line 56 of file stats.cc.

◆ Reset()

void operations_research::StatsGroup::Reset ( )

Calls Reset() on all the statistics registered with this group.

Definition at line 58 of file stats.cc.

◆ SetPrintOrder()

void operations_research::StatsGroup::SetPrintOrder ( PrintOrder print_order)
inline

Changes the print ordering (will affect the order in which the stats registered with this group are printed via StatString()).

Definition at line 154 of file stats.h.

◆ StatString()

std::string operations_research::StatsGroup::StatString ( ) const

Returns this group name, followed by one line per Stat registered with this group (this includes the ones created by LookupOrCreateTimeDistribution()).

Note
only the stats WorthPrinting() are printed.

Computes the longest name of all the stats we want to display. Also create a temporary vector so we can sort the stats by names.

We support UTF8 characters in the stat names.

Do not display groups without print-worthy stats.

Pretty-print all the stats.

Definition at line 77 of file stats.cc.


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