Basilisk CFD
Adaptive Cartesian mesh PDE framework
Loading...
Searching...
No Matches
perfs.h
Go to the documentation of this file.
1/** @file perfs.h
2 */
3/**
4# Performance monitoring (for the layered solver)
5
6This logs simple statistics available for the [layered
7solver](/src/layered/hydro.h). */
8
9/** @brief Event: perfs (i += 1) */
10void event_perfs (void) {
11 static FILE * fp = fopen ("perfs", "w");
12 if (i == 0)
13 fprintf (fp,
14 "t dt mgp.i mgp.nrelax grid->tn perf.t perf.speed npe perf.ispeed\n");
15 static double start = 0.;
16 if (i > 10 && perf.t - start < 1.) return 0;
17 fprintf (fp, "%g %g %d %d %ld %g %g %d %g\n",
18 t, dt,
19#if NH
20 mgp.i, mgp.nrelax,
22 mgH.i, mgH.nrelax,
23#else
24 0, 0,
25#endif
26 grid->tn*nl, perf.t, perf.speed*nl, npe(), perf.ispeed*nl);
27 fflush (fp);
28 start = perf.t;
29}
30
31/**
32If we have a display (and gnuplot works), a graph of the statistics is
33displayed and updated at regular intervals (10 seconds as defined in
34[perfs.plot]()). */
35
36/** @brief Event: perf_plot (i = 10) */
37void event_perf_plot (void) {
38 if (getenv ("DISPLAY"))
39 popen ("gnuplot -e 'set term x11 noraise title perfs' "
40 "\f$BASILISK/layered/perfs.plot 2> /dev/null "
41 "& read dummy; kill \f$! 2> /dev/null", "w");
42}
43
44/**
45## See also
46
47* [Performance monitoring (for the Navier-Stokes
48 solvers)](/src/navier-stokes/perfs.h).
49* [Continuous profiling monitoring](/src/profiling.h).
50*/
mgstats mgp
Definition all-mach.h:66
int npe
Definition balance.h:195
int x
Definition common.h:76
Grid * grid
Definition common.h:32
#define popen
Definition config.h:666
double dt
scalar int i
Definition embed.h:74
double t
Definition events.h:24
mgstats mgH
Definition implicit.h:26
#define IMPLICIT_H
Definition implicit.h:29
void event_perf_plot(void)
If we have a display (and gnuplot works), a graph of the statistics is displayed and updated at regul...
Definition perfs.h:37
int nl
Definition layers.h:9
FILE * fp
Definition mtrace.h:7
void event_perfs(void)
Event: perfs (i += 1)
Definition perfs.h:10
#define NH
long tn
Definition common.h:28
int nrelax
Definition poisson.h:116
int i
Definition poisson.h:113
struct @16 perf
Performance statistics are stored in this structure.
src vof fflush(ferr)