Geogram Version 1.8.5
A programming library of geometric algorithms
Loading...
Searching...
No Matches
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.
 
double elapsed_time () const
 Get the user elapsed time.
 
 ~Stopwatch ()
 Stopwatch destructor.
 

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.
Scope restricted stopwatch.
Definition stopwatch.h:179

Definition at line 179 of file stopwatch.h.

Constructor & Destructor Documentation

◆ Stopwatch()

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

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.

Definition at line 188 of file stopwatch.h.

◆ ~Stopwatch()

GEO::Stopwatch::~Stopwatch ( )
inline

Stopwatch destructor.

This prints the time epalsed since the Stopwatch construction

Definition at line 207 of file stopwatch.h.

Member Function Documentation

◆ elapsed_time()

double GEO::Stopwatch::elapsed_time ( ) const
inline

Get the user elapsed time.

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

Definition at line 197 of file stopwatch.h.


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