openCARP
Doxygen code documentation for the open cardiac electrophysiology simulator openCARP
timers.h
Go to the documentation of this file.
1 #ifndef _TIMERS_H
2 #define _TIMERS_H
3 
4 #include <string>
5 
6 #include "basics.h"
7 
8 namespace opencarp {
9 
12  int min = INT_MAX;
13  int max = 0;
14  int tot = 0;
15  int last_tot = 0;
16  int iter = 0;
17  int solves = 0;
18  int totsolves = 0;
19  double slvtime = 0.0;
20  double lastSlvtime = 0.0;
21  FILE_SPEC logger = NULL;
22 
24  {
25  f_close(logger);
26  }
27 
28  void init_logger(const char* filename);
29  void update_iter(const int curiter);
30  void log_stats(double tm, bool cflg);
31 };
32 
35  int calls = 0;
36  int tot_calls = 0;
37  double tot_time = 0.0;
38  double last_tot_time = 0.0;
39 
40  FILE_SPEC logger = NULL;
41 
43  {
44  f_close(logger);
45  }
46 
47  void init_logger(const char* filename);
48  void log_stats(double tm, bool cflg);
49 };
50 
51 
52 } // namespace opencarp
53 
54 
55 #endif // _TIMERS_H
Basic utility structs and functions, mostly IO related.
void f_close(FILE_SPEC &f)
Close a FILE_SPEC.
Definition: basics.cc:162
File descriptor struct.
Definition: basics.h:133
for analysis of the #iterations to solve CG
Definition: timers.h:34
void log_stats(double tm, bool cflg)
Definition: timers.cc:91
FILE_SPEC logger
file in which to write stats
Definition: timers.h:40
void init_logger(const char *filename)
Definition: timers.cc:75
int tot_calls
total # calls
Definition: timers.h:36
double last_tot_time
last total time
Definition: timers.h:38
int calls
# calls for this interval, this is incremented externally
Definition: timers.h:35
double tot_time
total time, this is incremented externally
Definition: timers.h:37
for analysis of the #iterations to solve CG
Definition: timers.h:11
void init_logger(const char *filename)
Definition: timers.cc:9
FILE_SPEC logger
file in which to write stats
Definition: timers.h:21
int last_tot
previous total #
Definition: timers.h:15
void log_stats(double tm, bool cflg)
Definition: timers.cc:25
int min
minimum #interations
Definition: timers.h:12
int max
maximum #iterations
Definition: timers.h:13
double lastSlvtime
total solver time
Definition: timers.h:20
void update_iter(const int curiter)
Definition: timers.cc:67
int solves
#solutions performed
Definition: timers.h:17
double slvtime
total solver time
Definition: timers.h:19
int iter
its previous solver step
Definition: timers.h:16
int totsolves
total # of solutions
Definition: timers.h:18