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 maxAD = std::numeric_limits<double>::quiet_NaN();
45  int tot = 0;
46  int last_tot = 0;
47  double slvtime_A = 0.0;
48  double lastSlvtime_A = 0.0;
49  double slvtime_B = 0.0;
50  double lastSlvtime_B = 0.0;
51  double slvtime_D = 0.0;
52  double lastSlvtime_D = 0.0;
53  int solves = 0;
54  int totsolves = 0;
55  bool bc_status = false;
56 
57  FILE_SPEC logger = NULL;
58 
60  {
61  f_close(logger);
62  }
63 
67  void init_logger(const char* filename, bool dream_mode);
68  void update_iter(const int curiter);
69  void log_stats(double time, bool cflg);
70  void update_cli(double time, bool cflg);
71 };
72 
75  int calls = 0;
76  int tot_calls = 0;
77  double tot_time = 0.0;
78  double last_tot_time = 0.0;
79 
80  FILE_SPEC logger = NULL;
81 
83  {
84  f_close(logger);
85  }
86 
87  void init_logger(const char* filename);
88  void log_stats(double tm, bool cflg);
89 };
90 
91 
92 } // namespace opencarp
93 
94 
95 #endif // _TIMERS_H
Basic utility structs and functions, mostly IO related.
void f_close(FILE_SPEC &f)
Close a FILE_SPEC.
Definition: basics.cc:155
for analysis of the computations done to solve the eikonal model
Definition: timers.h:39
int solves
#solutions performed
Definition: timers.h:53
FILE_SPEC logger
file in which to write stats
Definition: timers.h:57
double slvtime_A
total time in Step A
Definition: timers.h:47
int totsolves
total # of solutions
Definition: timers.h:54
double lastSlvtime_D
last total time in Step D
Definition: timers.h:52
double maxAD
DREAM: time horizon this sweep batch may search up to. Pure Eikonal: actual latest activation time re...
Definition: timers.h:44
double last_minAT
previous minimum activation time
Definition: timers.h:42
void log_stats(double time, bool cflg)
Definition: timers.cc:138
double minAT
minimum activation time in current solve
Definition: timers.h:43
int last_tot
previous total # iterations
Definition: timers.h:46
int cycle
DREAM cycle.
Definition: timers.h:40
int tot
total # iterations
Definition: timers.h:45
int activeList
number of nodes currently in list
Definition: timers.h:41
double lastSlvtime_A
last total time in Step A
Definition: timers.h:48
void update_iter(const int curiter)
Definition: timers.cc:170
double slvtime_B
total time in Step B
Definition: timers.h:49
void init_logger(const char *filename, bool dream_mode)
Definition: timers.cc:117
double slvtime_D
total time in Step D
Definition: timers.h:51
bool bc_status
boundary conditions were applied?
Definition: timers.h:55
void update_cli(double time, bool cflg)
Definition: timers.cc:176
double lastSlvtime_B
last total time in Step B
Definition: timers.h:50
File descriptor struct.
Definition: basics.h:120
for analysis of the #iterations to solve CG
Definition: timers.h:74
void log_stats(double tm, bool cflg)
Definition: timers.cc:96
FILE_SPEC logger
file in which to write stats
Definition: timers.h:80
void init_logger(const char *filename)
Definition: timers.cc:80
int tot_calls
total # calls
Definition: timers.h:76
double last_tot_time
last total time
Definition: timers.h:78
int calls
# calls for this interval, this is incremented externally
Definition: timers.h:75
double tot_time
total time, this is incremented externally
Definition: timers.h:77
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