aboutsummaryrefslogtreecommitdiff
path: root/Carpet/LoopControl
diff options
context:
space:
mode:
authorErik Schnetter <schnetter@gmail.com>2013-07-11 15:13:46 -0400
committerErik Schnetter <schnetter@gmail.com>2013-07-11 15:13:46 -0400
commitfb8888e0a686e1cec2351cd52631d2c838f4a87a (patch)
tree484228ff238e238d7c829fc53a8c8ba3b415e5de /Carpet/LoopControl
parent9882933435d2c7edc3423fc4d884d97c44caa2f4 (diff)
LoopControl: Do not output statistics by default
Diffstat (limited to 'Carpet/LoopControl')
-rw-r--r--Carpet/LoopControl/param.ccl6
-rw-r--r--Carpet/LoopControl/schedule.ccl4
-rw-r--r--Carpet/LoopControl/src/loopcontrol.cc19
3 files changed, 26 insertions, 3 deletions
diff --git a/Carpet/LoopControl/param.ccl b/Carpet/LoopControl/param.ccl
index a501ed0e0..33535f703 100644
--- a/Carpet/LoopControl/param.ccl
+++ b/Carpet/LoopControl/param.ccl
@@ -18,6 +18,12 @@ STRING statistics_filename "File name for LoopControl statistics" STEERABLE=alwa
".+" :: "file name"
} "LoopControl-statistics"
+REAL statistics_every_seconds "Output statistics every so many seconds" STEERABLE=always
+{
+ -1.0 :: "don't output"
+ 0.0:* :: "output every so many seconds"
+} -1.0
+
SHARES: IO
USES STRING out_dir
diff --git a/Carpet/LoopControl/schedule.ccl b/Carpet/LoopControl/schedule.ccl
index 6ad9df9eb..e73f72c7b 100644
--- a/Carpet/LoopControl/schedule.ccl
+++ b/Carpet/LoopControl/schedule.ccl
@@ -5,13 +5,13 @@ SCHEDULE lc_setup AT startup BEFORE Driver_Startup
LANG: C
} "Set up LoopControl"
-SCHEDULE lc_statistics_maybe AT analysis
+SCHEDULE lc_statistics_analysis AT analysis
{
LANG: C
OPTIONS: meta
} "Output LoopControl statistics"
-SCHEDULE lc_statistics AT terminate
+SCHEDULE lc_statistics_terminate AT terminate
{
LANG: C
OPTIONS: meta
diff --git a/Carpet/LoopControl/src/loopcontrol.cc b/Carpet/LoopControl/src/loopcontrol.cc
index ac214e836..2915f922d 100644
--- a/Carpet/LoopControl/src/loopcontrol.cc
+++ b/Carpet/LoopControl/src/loopcontrol.cc
@@ -1243,7 +1243,24 @@ void lc_statistics(CCTK_ARGUMENTS)
fclose(descrfile);
}
-void lc_statistics_maybe(CCTK_ARGUMENTS)
+void lc_statistics_analysis(CCTK_ARGUMENTS)
+{
+ DECLARE_CCTK_ARGUMENTS;
+ DECLARE_CCTK_PARAMETERS;
+
+ static double last_output = 0.0;
+ const double run_time = CCTK_RunTime();
+
+ if (veryverbose ||
+ (statistics_every_seconds >= 0.0 &&
+ run_time >= last_output + statistics_every_seconds))
+ {
+ lc_statistics(CCTK_PASS_CTOC);
+ last_output = run_time;
+ }
+}
+
+void lc_statistics_terminate(CCTK_ARGUMENTS)
{
DECLARE_CCTK_ARGUMENTS;
DECLARE_CCTK_PARAMETERS;