Prusa Slicer 2.6.0
Loading...
Searching...
No Matches
Benchmark Class Reference

#include <src/libnest2d/tools/benchmark.h>

Public Member Functions

void start ()
 
void stop ()
 
double getElapsedSec ()
 

Private Types

typedef std::chrono::high_resolution_clock Clock
 
typedef Clock::duration Duration
 
typedef Clock::time_point TimePoint
 

Private Member Functions

double to_sec (Duration d)
 

Private Attributes

TimePoint t1
 
TimePoint t2
 
Duration d
 

Detailed Description

A class for doing benchmarks.

Member Typedef Documentation

◆ Clock

typedef std::chrono::high_resolution_clock Benchmark::Clock
private

◆ Duration

typedef Clock::duration Benchmark::Duration
private

◆ TimePoint

typedef Clock::time_point Benchmark::TimePoint
private

Member Function Documentation

◆ getElapsedSec()

double Benchmark::getElapsedSec ( )
inline

Get the time elapsed between a start() end a stop() call.

Returns
Returns the elapsed time in seconds.
54{ d = t2 - t1; return to_sec(d); }
double to_sec(Duration d)
Definition benchmark.h:34
TimePoint t2
Definition benchmark.h:31
TimePoint t1
Definition benchmark.h:31
Duration d
Definition benchmark.h:32

References d, t1, t2, and to_sec().

Referenced by Slic3r::sla::create_support_tree(), Slic3r::SLAPrint::Steps::generate_preview(), and Slic3r::SLAPrint::process().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ start()

void Benchmark::start ( )
inline

Measure time from the moment of this call.

43{ t1 = Clock::now(); }

References t1.

Referenced by Slic3r::sla::create_support_tree(), Slic3r::SLAPrint::Steps::generate_preview(), and Slic3r::SLAPrint::process().

+ Here is the caller graph for this function:

◆ stop()

void Benchmark::stop ( )
inline

Measure time to the moment of this call.

48{ t2 = Clock::now(); }

References t2.

Referenced by Slic3r::sla::create_support_tree(), Slic3r::SLAPrint::Steps::generate_preview(), and Slic3r::SLAPrint::process().

+ Here is the caller graph for this function:

◆ to_sec()

double Benchmark::to_sec ( Duration  d)
inlineprivate
34 {
35 return d.count() * double(Duration::period::num) / Duration::period::den;
36 }

References d.

Referenced by getElapsedSec().

+ Here is the caller graph for this function:

Member Data Documentation

◆ d

Duration Benchmark::d
private

Referenced by getElapsedSec(), and to_sec().

◆ t1

TimePoint Benchmark::t1
private

Referenced by getElapsedSec(), and start().

◆ t2

TimePoint Benchmark::t2
private

Referenced by getElapsedSec(), and stop().


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