Geogram Version 1.8.5
A programming library of geometric algorithms
Loading...
Searching...
No Matches
GEO::SystemStopwatch Class Reference

Measures the time taken by an algorithm. More...

#include <geogram/basic/stopwatch.h>

Public Member Functions

 SystemStopwatch ()
 SystemStopwatch constructor.
 
void print_elapsed_time (std::ostream &os) const
 Prints elapsed time to a stream.
 
double elapsed_user_time () const
 Get the user elapsed time.
 

Static Public Member Functions

static double now ()
 

Detailed Description

Measures the time taken by an algorithm.

SystemStopwatch provides functions to get or print the time elapsed since its construction. The times computed by SystemStopwatch are expressed as system ticks, which is a system dependent unit. SystemStopwatch prints three different times:

  • real time: the really elapsed time (depends on the load of the machine, i.e. on the others programs that are executed at the same time).
  • system time: the time spent in system calls.
  • user time: the time really spent in the process.

Example:

{
do_something() ;
clock.print_elapsed_time(std::cout) ;
}
Measures the time taken by an algorithm.
Definition stopwatch.h:89
void print_elapsed_time(std::ostream &os) const
Prints elapsed time to a stream.

Definition at line 89 of file stopwatch.h.

Constructor & Destructor Documentation

◆ SystemStopwatch()

GEO::SystemStopwatch::SystemStopwatch ( )

SystemStopwatch constructor.

It remembers the current time as the reference time for functions elapsed_user_time() and print_elapsed_time().

Member Function Documentation

◆ elapsed_user_time()

double GEO::SystemStopwatch::elapsed_user_time ( ) const

Get the user elapsed time.

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

◆ now()

static double GEO::SystemStopwatch::now ( )
static

Gets the current time (in seconds).

◆ print_elapsed_time()

void GEO::SystemStopwatch::print_elapsed_time ( std::ostream &  os) const

Prints elapsed time to a stream.

Prints real, user and system times since the construction of this SystemStopWatch (in seconds).


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