Graphite  Version 3
An experimental 3D geometry processing program
GEO::Stopwatch Class Reference

Scope restricted stopwatch. More...

#include <geogram/basic/stopwatch.h>

Public Member Functions

 Stopwatch (const std::string &task_name, bool verbose=true)
 Stopwatch constructor. More...
 
 Stopwatch ()
 Stopwatch constructor. More...
 
double elapsed_time () const
 Get the user elapsed time. More...
 
 ~Stopwatch ()
 Stopwatch destructor. More...
 

Static Public Member Functions

static double now ()
 
static double process_elapsed_time ()
 
static void initialize ()
 
static void show_stats ()
 

Detailed Description

Scope restricted stopwatch.

Stopwatch prints the elapsed time since its construction when it goes out of scope. It uses SystemStopwatch to measure time.

{
Stopwatch W("compute my stuff") ;
... do something ...
} // <- W prints the elapsed time here.
Stopwatch()
Stopwatch constructor.

Definition at line 69 of file stopwatch.h.

Constructor & Destructor Documentation

◆ Stopwatch() [1/2]

GEO::Stopwatch::Stopwatch ( const std::string &  task_name,
bool  verbose = true 
)

Stopwatch constructor.

Parameters
[in]task_namename of the job to measure. This name is used as a Logger feature when displaying the elapsed time.
[in]verboseif true, then elapsed time is displayed when this Stopwatch is destroyed, else nothing is displayed.

◆ Stopwatch() [2/2]

GEO::Stopwatch::Stopwatch ( )

Stopwatch constructor.

Constructs a silent (verbose=false) Stopwatch

◆ ~Stopwatch()

GEO::Stopwatch::~Stopwatch ( )

Stopwatch destructor.

This prints the time elapsed since the Stopwatch construction

Member Function Documentation

◆ elapsed_time()

double GEO::Stopwatch::elapsed_time ( ) const

Get the user elapsed time.

Returns the user time elapsed since the StopWatch construction (in seconds)

◆ now()

static double GEO::Stopwatch::now ( )
static

Gets the current time since epoch (in seconds).

◆ process_elapsed_time()

static double GEO::Stopwatch::process_elapsed_time ( )
inlinestatic

Gets the total elapsed time since process start (in seconds).

Definition at line 109 of file stopwatch.h.


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