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 */
5
6/** @brief Event: perfs (i += 1) */
7void event_perfs (void) {
8 static FILE * fp = fopen ("perfs", "w");
9 if (i == 0)
10 fprintf (fp,
11 "t dt grid->tn perf.t perf.speed npe perf.ispeed maxrss\n");
12 static double start = 0.;
13 if (i > 10 && perf.t - start < 1.) return 0;
14 fprintf (fp, "%g %g %ld %g %g %d %g ",
15 t, dt,
16 grid->tn*nl, perf.t, perf.speed*nl, npe(), perf.ispeed*nl);
18 struct rusage usage;
20 fprintf (fp, "%ld\n", usage.ru_maxrss);
21@else
22 fputs ("0\n", fp);
23@endif
24 fflush (fp);
25 start = perf.t;
26}
27
28/**
29If we have a display (and gnuplot works), a graph of the statistics is
30displayed and updated at regular intervals (10 seconds as defined in
31[perfs.plot]()). */
32
33/** @brief Event: perf_plot (i = 10) */
34void event_perf_plot (void) {
35 if (getenv ("DISPLAY"))
36 popen ("gnuplot -e 'set term x11 noraise title perfs' "
37 "\f$BASILISK/perfs.plot 2> /dev/null "
38 "& read dummy; kill \f$! 2> /dev/null", "w");
39}
40
41/**
42## See also
43
44* [Performance monitoring (for the layered
45 solver)](/src/layered/perfs.h).
46* [Performance monitoring (for the Navier-Stokes
47 solvers)](/src/navier-stokes/perfs.h).
48* [Continuous profiling monitoring](/src/profiling.h).
49*/
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
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
long tn
Definition common.h:28
struct @16 perf
Performance statistics are stored in this structure.
src vof fflush(ferr)