src/perfs.h
Performance monitoring
event perfs (i += 1) {
static FILE * fp = fopen ("perfs", "w");
if (i == 0)
fprintf (fp,
"t dt grid->tn perf.t perf.speed npe perf.ispeed maxrss\n");
static double start = 0.;
if (i > 10 && perf.t - start < 1.) return 0;
fprintf (fp, "%g %g %ld %g %g %d %g ",
, dt,
t->tn*nl, perf.t, perf.speed*nl, npe(), perf.ispeed*nl);
grid
@if _GNU_SOURCEstruct rusage usage;
(RUSAGE_SELF, &usage);
getrusage fprintf (fp, "%ld\n", usage.ru_maxrss);
@else("0\n", fp);
fputs
@endiffflush (fp);
= perf.t;
start }
If we have a display (and gnuplot works), a graph of the statistics is displayed and updated at regular intervals (10 seconds as defined in perfs.plot).
event perf_plot (i = 10) {
if (getenv ("DISPLAY"))
popen ("gnuplot -e 'set term x11 noraise title perfs' "
"$BASILISK/perfs.plot "
"& read dummy; kill $!", "w");
}