openCARP
Doxygen code documentation for the open cardiac electrophysiology simulator openCARP
timers.h
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: Copyright (c) NumeriCor GmbH
2 // SPDX-License-Identifier: Apache-2.0
3 
4 #ifndef _TIMERS_H
5 #define _TIMERS_H
6 
7 #include <climits>
8 #include <limits>
9 #include <string>
10 
11 #include "basics.h"
12 
13 namespace opencarp {
14 
17  int min = INT_MAX;
18  int max = 0;
19  int tot = 0;
20  int last_tot = 0;
21  int iter = 0;
22  int solves = 0;
23  int totsolves = 0;
24  double slvtime = 0.0;
25  double lastSlvtime = 0.0;
26  FILE_SPEC logger = NULL;
27 
29  {
30  f_close(logger);
31  }
32 
33  void init_logger(const char* filename);
34  void update_iter(const int curiter);
35  void log_stats(double tm, bool cflg);
36 };
37 
40  int cycle = 0;
41  int activeList = 0;
42  double last_minAT = 0;
43  double minAT = 0;
44  double last_maxAT = std::numeric_limits<double>::quiet_NaN();
45  double maxAT = std::numeric_limits<double>::quiet_NaN();
46  int tot = 0;
47  int last_tot = 0;
48  double slvtime_A = 0.0;
49  double lastSlvtime_A = 0.0;
50  double slvtime_B = 0.0;
51  double lastSlvtime_B = 0.0;
52  double slvtime_D = 0.0;
53  double lastSlvtime_D = 0.0;
54  int solves = 0;
55  int totsolves = 0;
56  bool bc_status = false;
57 
58  FILE_SPEC logger = NULL;
59 
61  {
62  f_close(logger);
63  }
64 
65  void init_logger(const char* filename);
66  void update_iter(const int curiter);
67  void log_stats(double time, bool cflg);
68  void update_cli(double time, bool cflg);
69 };
70 
73  int calls = 0;
74  int tot_calls = 0;
75  double tot_time = 0.0;
76  double last_tot_time = 0.0;
77 
78  FILE_SPEC logger = NULL;
79 
81  {
82  f_close(logger);
83  }
84 
85  void init_logger(const char* filename);
86  void log_stats(double tm, bool cflg);
87 };
88 
89 
90 } // namespace opencarp
91 
92 
93 #endif // _TIMERS_H
Basic utility structs and functions, mostly IO related.
void f_close(FILE_SPEC &f)
Close a FILE_SPEC.
Definition: basics.cc:150
for analysis of the computations done to solve the eikonal model
Definition: timers.h:39
int solves
#solutions performed
Definition: timers.h:54
FILE_SPEC logger
file in which to write stats
Definition: timers.h:58
double slvtime_A
total time in Step A
Definition: timers.h:48
int totsolves
total # of solutions
Definition: timers.h:55
double lastSlvtime_D
last total time in Step D
Definition: timers.h:53
double last_minAT
previous minimum activation time
Definition: timers.h:42
void log_stats(double time, bool cflg)
Definition: timers.cc:133
double minAT
minimum activation time in current solve
Definition: timers.h:43
int last_tot
previous total # iterations
Definition: timers.h:47
double last_maxAT
previous maximum activation time
Definition: timers.h:44
double maxAT
maximum activation time in current solve
Definition: timers.h:45
int cycle
DREAM cycle.
Definition: timers.h:40
void init_logger(const char *filename)
Definition: timers.cc:117
int tot
total # iterations
Definition: timers.h:46
int activeList
number of nodes currently in list
Definition: timers.h:41
double lastSlvtime_A
last total time in Step A
Definition: timers.h:49
void update_iter(const int curiter)
Definition: timers.cc:165
double slvtime_B
total time in Step B
Definition: timers.h:50
double slvtime_D
total time in Step D
Definition: timers.h:52
bool bc_status
boundary conditions were applied?
Definition: timers.h:56
void update_cli(double time, bool cflg)
Definition: timers.cc:171
double lastSlvtime_B
last total time in Step B
Definition: timers.h:51
File descriptor struct.
Definition: basics.h:120
for analysis of the #iterations to solve CG
Definition: timers.h:72
void log_stats(double tm, bool cflg)
Definition: timers.cc:96
FILE_SPEC logger
file in which to write stats
Definition: timers.h:78
void init_logger(const char *filename)
Definition: timers.cc:80
int tot_calls
total # calls
Definition: timers.h:74
double last_tot_time
last total time
Definition: timers.h:76
int calls
# calls for this interval, this is incremented externally
Definition: timers.h:73
double tot_time
total time, this is incremented externally
Definition: timers.h:75
for analysis of the #iterations to solve CG
Definition: timers.h:16
void init_logger(const char *filename)
Definition: timers.cc:14
FILE_SPEC logger
file in which to write stats
Definition: timers.h:26
int last_tot
previous total #
Definition: timers.h:20
void log_stats(double tm, bool cflg)
Definition: timers.cc:30
int min
minimum #interations
Definition: timers.h:17
int max
maximum #iterations
Definition: timers.h:18
double lastSlvtime
total solver time
Definition: timers.h:25
void update_iter(const int curiter)
Definition: timers.cc:72
int solves
#solutions performed
Definition: timers.h:22
double slvtime
total solver time
Definition: timers.h:24
int iter
its previous solver step
Definition: timers.h:21
int totsolves
total # of solutions
Definition: timers.h:23