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

#include <stats.h>

Public Member Functions

 EnabledScopedTimeDistributionUpdater (TimeDistribution *stat)
 
 EnabledScopedTimeDistributionUpdater (const EnabledScopedTimeDistributionUpdater &)=delete
 This type is neither copyable nor movable.
 
EnabledScopedTimeDistributionUpdateroperator= (const EnabledScopedTimeDistributionUpdater &)=delete
 
 ~EnabledScopedTimeDistributionUpdater ()
 
void AlsoUpdate (TimeDistribution *also_update)
 

Detailed Description

Helper classes to time a block of code and add the result to a TimeDistribution. Calls StartTimer() on creation and StopTimerAndAddElapsedTime() on destruction.

There are three classes with the same interface:

  • EnabledScopedTimeDistributionUpdater always collects the time stats of the scope in which it is defined. This class is used for stats that are always collected.
  • ScopedTimeDistributionUpdater collects the time stats only when OR_STATS is defined. This symbol should be used for collecting stats in places where the overhead of collecting the stats may hurt the performance of the algorithm.
  • DisabledScopedTimeDistributionUpdater is used to implement ScopedTimeDistributionUpdater when OR_STATS is not defined.

Definition at line 313 of file stats.h.

Constructor & Destructor Documentation

◆ EnabledScopedTimeDistributionUpdater() [1/2]

operations_research::EnabledScopedTimeDistributionUpdater::EnabledScopedTimeDistributionUpdater ( TimeDistribution * stat)
inlineexplicit
Note
this does not take ownership of the given stat.

Definition at line 316 of file stats.h.

◆ EnabledScopedTimeDistributionUpdater() [2/2]

operations_research::EnabledScopedTimeDistributionUpdater::EnabledScopedTimeDistributionUpdater ( const EnabledScopedTimeDistributionUpdater & )
delete

This type is neither copyable nor movable.

◆ ~EnabledScopedTimeDistributionUpdater()

operations_research::EnabledScopedTimeDistributionUpdater::~EnabledScopedTimeDistributionUpdater ( )
inline

Definition at line 326 of file stats.h.

Member Function Documentation

◆ AlsoUpdate()

void operations_research::EnabledScopedTimeDistributionUpdater::AlsoUpdate ( TimeDistribution * also_update)
inline

Updates another TimeDistribution on destruction. This is useful to split a total time measurement in different categories:

EnabledScopedTimeDistributionUpdater timer(&total_timer); ... switch (type) { case TypeA : timer.AlsoUpdate(&typeA_timer); break; case TypeB : timer.AlsoUpdate(&typeB_timer); break; }

Definition at line 342 of file stats.h.

◆ operator=()

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

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