List of all members | Public Member Functions | Public Attributes
casadi::FStats Class Reference

#include <timing.hpp>

Detailed Description

Timer class

FStats hack; hack.tic(); .... hack.toc();

Definition at line 47 of file timing.hpp.

Public Member Functions

 FStats ()
 Constructor. More...
 
void reset ()
 Reset the statistics. More...
 
void tic ()
 Start timing. More...
 
void toc ()
 Stop timing. More...
 
void join (FStats &rhs)
 

Public Attributes

casadi_int n_call = 0
 Accumulated number of calls since last reset. More...
 
double t_wall = 0
 Accumulated wall time [s] since last reset. More...
 
double t_proc = 0
 Accumulated proc time [s] since last reset. More...
 

Constructor & Destructor Documentation

◆ FStats()

casadi::FStats::FStats ( )

Definition at line 31 of file timing.cpp.

31  {
32  }

Member Function Documentation

◆ join()

void casadi::FStats::join ( FStats rhs)

Definition at line 59 of file timing.cpp.

59  {
60  t_proc += rhs.t_proc;
61  t_wall += rhs.t_wall;
62  n_call += rhs.n_call;
63  }
double t_wall
Accumulated wall time [s] since last reset.
Definition: timing.hpp:78
double t_proc
Accumulated proc time [s] since last reset.
Definition: timing.hpp:81
casadi_int n_call
Accumulated number of calls since last reset.
Definition: timing.hpp:75

References n_call, t_proc, and t_wall.

◆ reset()

void casadi::FStats::reset ( )

Definition at line 34 of file timing.cpp.

34  {
35  n_call = 0;
36  t_wall = 0;
37  t_proc = 0;
38  }

◆ tic()

void casadi::FStats::tic ( )

Definition at line 40 of file timing.cpp.

40  {
41  start_proc = std::clock();
42  start_wall= high_resolution_clock::now();
43  }

Referenced by casadi::LinsolCall< Tr >::eval(), casadi::ScopedTiming::ScopedTiming(), and casadi::Linsol::solve().

◆ toc()

void casadi::FStats::toc ( )

Definition at line 45 of file timing.cpp.

45  {
46  // First get the time points
47  stop_proc = std::clock();
48  stop_wall = high_resolution_clock::now();
49 
50  // Process them
51  double proc = static_cast<double>(stop_proc - start_proc) / static_cast<double>(CLOCKS_PER_SEC);
52  t_proc += proc;
53  double wall = duration<double>(stop_wall - start_wall).count();
54  t_wall += wall;
55  n_call +=1;
56 
57  }

Referenced by casadi::ScopedTiming::~ScopedTiming().

Member Data Documentation

◆ n_call

casadi_int casadi::FStats::n_call = 0

Definition at line 75 of file timing.hpp.

Referenced by join().

◆ t_proc

double casadi::FStats::t_proc = 0

Definition at line 81 of file timing.hpp.

Referenced by join().

◆ t_wall

double casadi::FStats::t_wall = 0

Definition at line 78 of file timing.hpp.

Referenced by join().


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