aboutsummaryrefslogtreecommitdiff
path: root/Carpet/Carpet/src/Timing.cc
diff options
context:
space:
mode:
authorErik Schnetter <schnetter@cct.lsu.edu>2010-02-13 18:35:46 -0600
committerBarry Wardell <barry.wardell@gmail.com>2011-12-14 16:45:26 +0000
commit9fdfb2dfb4690d0867d36f77a2864443e11e3d4f (patch)
tree9263fb97cf511b853e9d26332d09783d02112db3 /Carpet/Carpet/src/Timing.cc
parent3b52b3721d634461b2d3840db16735b78a4a8cad (diff)
Carpet: Introduce per-level timers
Diffstat (limited to 'Carpet/Carpet/src/Timing.cc')
-rw-r--r--Carpet/Carpet/src/Timing.cc40
1 files changed, 40 insertions, 0 deletions
diff --git a/Carpet/Carpet/src/Timing.cc b/Carpet/Carpet/src/Timing.cc
index 2fd24f3bd..51ecc45e8 100644
--- a/Carpet/Carpet/src/Timing.cc
+++ b/Carpet/Carpet/src/Timing.cc
@@ -132,6 +132,10 @@ namespace Carpet {
timing_state_t timing_state = state_computing;
CCTK_REAL time_start;
+ // Last starting time for this level
+ int timing_level = -1;
+ CCTK_REAL time_level_start;
+
// Initialise the timing variables (to be called before basegrid)
@@ -139,6 +143,7 @@ namespace Carpet {
InitTimingStats (cGH const * const cctkGH)
{
DECLARE_CCTK_ARGUMENTS;
+ DECLARE_CCTK_PARAMETERS;
startup_walltime = get_walltime();
@@ -172,8 +177,15 @@ namespace Carpet {
* comm_count = 0.0;
* comm_bytes_count = 0.0;
+ * time_levels = 0.0;
+
* grid_points_per_second = 0.0;
* grid_point_updates_count = 0.0;
+
+ for (int rl=0; rl<max_refinement_levels; ++rl) {
+ time_level [rl] = 0.0;
+ time_level_count[rl] = 0.0;
+ }
}
@@ -215,6 +227,34 @@ namespace Carpet {
+ // Count time spent on individual levels (to be called from Carpet's
+ // initialisation, evolution, and shutdown drivers)
+ void
+ BeginTimingLevel (cGH const * const cctkGH)
+ {
+ assert (reflevel != -1);
+ assert (timing_level == -1);
+ timing_level = reflevel;
+ time_level_start = get_walltime();
+ }
+
+ void
+ EndTimingLevel (cGH const * const cctkGH)
+ {
+ DECLARE_CCTK_ARGUMENTS;
+
+ assert (reflevel != -1);
+ assert (timing_level == reflevel);
+ timing_level = -1;
+ CCTK_REAL const time_level_end = get_walltime();
+
+ time_level[reflevel] += time_level_end - time_level_start;
+ ++ time_level_count[reflevel];
+ * time_levels += time_level_end - time_level_start;
+ }
+
+
+
// Count some I/O (to be called from the I/O routine)
void
BeginTimingIO (cGH const * const cctkGH)