From c53c68b4331499481fbdddc6f01472c334b8f5f2 Mon Sep 17 00:00:00 2001
From: Chichi Lalescu <chichilalescu@gmail.com>
Date: Sun, 9 Sep 2018 12:09:01 +0200
Subject: [PATCH] update timer to output debug message

---
 bfps/cpp/full_code/NSVE.cpp                   |  6 ++++
 bfps/cpp/full_code/NSVE_field_stats.cpp       |  4 +++
 bfps/cpp/full_code/NSVE_no_output.hpp         | 29 ++++++++++++++++-
 bfps/cpp/full_code/NSVEcomplex_particles.cpp  | 32 +++++++++++++++++++
 bfps/cpp/full_code/NSVEp_extra_sampling.cpp   |  3 ++
 bfps/cpp/full_code/NSVEparticles.cpp          |  9 ++++++
 .../cpp/full_code/NSVEparticles_no_output.hpp |  3 +-
 bfps/cpp/full_code/code_base.cpp              | 32 +++++++++++++++++++
 .../full_code/direct_numerical_simulation.cpp |  5 +++
 bfps/cpp/full_code/field_output_test.cpp      |  4 +++
 bfps/cpp/full_code/field_single_to_double.cpp |  4 ++-
 bfps/cpp/full_code/field_test.cpp             | 13 ++++----
 bfps/cpp/full_code/filter_test.cpp            | 13 ++++----
 bfps/cpp/full_code/get_rfields.cpp            |  4 ++-
 bfps/cpp/full_code/joint_acc_vel_stats.cpp    |  4 ++-
 bfps/cpp/full_code/native_binary_to_hdf5.cpp  |  4 +++
 bfps/cpp/full_code/postprocess.cpp            |  2 ++
 bfps/cpp/full_code/resize.cpp                 |  4 ++-
 bfps/cpp/full_code/symmetrize_test.cpp        |  4 +++
 bfps/cpp/full_code/test.cpp                   |  4 +--
 bfps/cpp/full_code/test_interpolation.cpp     |  4 +++
 bfps/cpp/scope_timer.hpp                      |  3 +-
 22 files changed, 168 insertions(+), 22 deletions(-)

diff --git a/bfps/cpp/full_code/NSVE.cpp b/bfps/cpp/full_code/NSVE.cpp
index ce0a9544..d9cb72a2 100644
--- a/bfps/cpp/full_code/NSVE.cpp
+++ b/bfps/cpp/full_code/NSVE.cpp
@@ -7,6 +7,7 @@
 template <typename rnumber>
 int NSVE<rnumber>::initialize(void)
 {
+    TIMEZONE("NSVE::initialize");
     this->read_iteration();
     this->read_parameters();
     if (this->myrank == 0)
@@ -67,6 +68,7 @@ int NSVE<rnumber>::initialize(void)
 template <typename rnumber>
 int NSVE<rnumber>::step(void)
 {
+    TIMEZONE("NSVE::step");
     this->fs->step(this->dt);
     this->iteration = this->fs->iteration;
     return EXIT_SUCCESS;
@@ -75,6 +77,7 @@ int NSVE<rnumber>::step(void)
 template <typename rnumber>
 int NSVE<rnumber>::write_checkpoint(void)
 {
+    TIMEZONE("NSVE::write_checkpoint");
     this->fs->io_checkpoint(false);
     this->checkpoint = this->fs->checkpoint;
     this->write_iteration();
@@ -84,6 +87,7 @@ int NSVE<rnumber>::write_checkpoint(void)
 template <typename rnumber>
 int NSVE<rnumber>::finalize(void)
 {
+    TIMEZONE("NSVE::finalize");
     if (this->myrank == 0)
         H5Fclose(this->stat_file);
     delete this->fs;
@@ -104,6 +108,7 @@ int NSVE<rnumber>::finalize(void)
 template <typename rnumber>
 int NSVE<rnumber>::do_stats()
 {
+    TIMEZONE("NSVE::do_stats");
     if (!(this->iteration % this->niter_stat == 0))
         return EXIT_SUCCESS;
     hid_t stat_group;
@@ -140,6 +145,7 @@ int NSVE<rnumber>::do_stats()
 template <typename rnumber>
 int NSVE<rnumber>::read_parameters(void)
 {
+    TIMEZONE("NSVE::read_parameters");
     this->direct_numerical_simulation::read_parameters();
     hid_t parameter_file = H5Fopen((this->simname + ".h5").c_str(), H5F_ACC_RDONLY, H5P_DEFAULT);
     this->nu = hdf5_tools::read_value<double>(parameter_file, "parameters/nu");
diff --git a/bfps/cpp/full_code/NSVE_field_stats.cpp b/bfps/cpp/full_code/NSVE_field_stats.cpp
index 7e33acf9..15980a20 100644
--- a/bfps/cpp/full_code/NSVE_field_stats.cpp
+++ b/bfps/cpp/full_code/NSVE_field_stats.cpp
@@ -7,6 +7,7 @@
 template <typename rnumber>
 int NSVE_field_stats<rnumber>::initialize(void)
 {
+    TIMEZONE("NSVE_field_stats::initialize");
     this->postprocess::read_parameters();
     this->vorticity = new field<rnumber, FFTW, THREE>(
             nx, ny, nz,
@@ -49,6 +50,7 @@ int NSVE_field_stats<rnumber>::initialize(void)
 template <typename rnumber>
 int NSVE_field_stats<rnumber>::read_current_cvorticity(void)
 {
+    TIMEZONE("NSVE_field_stats::read_current_cvorticity");
     this->vorticity->real_space_representation = false;
     if (this->bin_IO != NULL)
     {
@@ -76,6 +78,7 @@ int NSVE_field_stats<rnumber>::read_current_cvorticity(void)
 template <typename rnumber>
 int NSVE_field_stats<rnumber>::finalize(void)
 {
+    TIMEZONE("NSVE_field_stats::finalize");
     if (this->bin_IO != NULL)
         delete this->bin_IO;
     delete this->vorticity;
@@ -85,6 +88,7 @@ int NSVE_field_stats<rnumber>::finalize(void)
 template <typename rnumber>
 int NSVE_field_stats<rnumber>::work_on_current_iteration(void)
 {
+    TIMEZONE("NSVE_field_stats::work_on_current_iteration");
     return EXIT_SUCCESS;
 }
 
diff --git a/bfps/cpp/full_code/NSVE_no_output.hpp b/bfps/cpp/full_code/NSVE_no_output.hpp
index b98f89f6..045db08e 100644
--- a/bfps/cpp/full_code/NSVE_no_output.hpp
+++ b/bfps/cpp/full_code/NSVE_no_output.hpp
@@ -1,3 +1,29 @@
+/**********************************************************************
+*                                                                     *
+*  Copyright 2017 Max Planck Institute                                *
+*                 for Dynamics and Self-Organization                  *
+*                                                                     *
+*  This file is part of bfps.                                         *
+*                                                                     *
+*  bfps is free software: you can redistribute it and/or modify       *
+*  it under the terms of the GNU General Public License as published  *
+*  by the Free Software Foundation, either version 3 of the License,  *
+*  or (at your option) any later version.                             *
+*                                                                     *
+*  bfps is distributed in the hope that it will be useful,            *
+*  but WITHOUT ANY WARRANTY; without even the implied warranty of     *
+*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the      *
+*  GNU General Public License for more details.                       *
+*                                                                     *
+*  You should have received a copy of the GNU General Public License  *
+*  along with bfps.  If not, see <http://www.gnu.org/licenses/>       *
+*                                                                     *
+* Contact: Cristian.Lalescu@ds.mpg.de                                 *
+*                                                                     *
+**********************************************************************/
+
+
+
 #ifndef NSVE_NO_OUTPUT_HPP
 #define NSVE_NO_OUTPUT_HPP
 
@@ -16,7 +42,8 @@ class NSVE_no_output: public NSVE<rnumber>
     ~NSVE_no_output(){}
     int write_checkpoint(void)
     {
-        return 0;
+        TIMEZONE("NSVE_no_output::write_checkpoint");
+        return EXIT_SUCCESS;
     }
 };
 
diff --git a/bfps/cpp/full_code/NSVEcomplex_particles.cpp b/bfps/cpp/full_code/NSVEcomplex_particles.cpp
index 1e138711..81c6cd5f 100644
--- a/bfps/cpp/full_code/NSVEcomplex_particles.cpp
+++ b/bfps/cpp/full_code/NSVEcomplex_particles.cpp
@@ -1,3 +1,29 @@
+/**********************************************************************
+*                                                                     *
+*  Copyright 2017 Max Planck Institute                                *
+*                 for Dynamics and Self-Organization                  *
+*                                                                     *
+*  This file is part of bfps.                                         *
+*                                                                     *
+*  bfps is free software: you can redistribute it and/or modify       *
+*  it under the terms of the GNU General Public License as published  *
+*  by the Free Software Foundation, either version 3 of the License,  *
+*  or (at your option) any later version.                             *
+*                                                                     *
+*  bfps is distributed in the hope that it will be useful,            *
+*  but WITHOUT ANY WARRANTY; without even the implied warranty of     *
+*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the      *
+*  GNU General Public License for more details.                       *
+*                                                                     *
+*  You should have received a copy of the GNU General Public License  *
+*  along with bfps.  If not, see <http://www.gnu.org/licenses/>       *
+*                                                                     *
+* Contact: Cristian.Lalescu@ds.mpg.de                                 *
+*                                                                     *
+**********************************************************************/
+
+
+
 #include <string>
 #include <cmath>
 #include "NSVEcomplex_particles.hpp"
@@ -9,6 +35,7 @@
 template <typename rnumber>
 int NSVEcomplex_particles<rnumber>::initialize(void)
 {
+    TIMEZONE("NSVEcomplex_particles::initialize");
     this->NSVE<rnumber>::initialize();
 
     p2p_computer<double, long long int> current_p2p_computer;
@@ -63,6 +90,7 @@ int NSVEcomplex_particles<rnumber>::initialize(void)
 template <typename rnumber>
 int NSVEcomplex_particles<rnumber>::step(void)
 {
+    TIMEZONE("NSVEcomplex_particles::step");
     this->fs->compute_velocity(this->fs->cvorticity);
     this->fs->cvelocity->ift();
     if(enable_vorticity_omega){
@@ -80,6 +108,7 @@ int NSVEcomplex_particles<rnumber>::step(void)
 template <typename rnumber>
 int NSVEcomplex_particles<rnumber>::write_checkpoint(void)
 {
+    TIMEZONE("NSVEcomplex_particles::write_checkpoint");
     this->NSVE<rnumber>::write_checkpoint();
     this->particles_output_writer_mpi->open_file(this->fs->get_current_fname());
     // TODO P2P write particle data too
@@ -96,6 +125,7 @@ int NSVEcomplex_particles<rnumber>::write_checkpoint(void)
 template <typename rnumber>
 int NSVEcomplex_particles<rnumber>::finalize(void)
 {
+    TIMEZONE("NSVEcomplex_particles::finalize");
     delete this->nabla_u;
     delete this->particles_output_writer_mpi;
     delete this->particles_sample_writer_mpi;
@@ -109,6 +139,7 @@ int NSVEcomplex_particles<rnumber>::finalize(void)
 template <typename rnumber>
 int NSVEcomplex_particles<rnumber>::do_stats()
 {
+    TIMEZONE("NSVEcomplex_particles::do_stats");
     /// perform fluid stats
     this->NSVE<rnumber>::do_stats();
 
@@ -194,6 +225,7 @@ int NSVEcomplex_particles<rnumber>::do_stats()
 template <typename rnumber>
 int NSVEcomplex_particles<rnumber>::read_parameters(void)
 {
+    TIMEZONE("NSVEcomplex_particles::read_parameters");
     this->NSVE<rnumber>::read_parameters();
     hid_t parameter_file = H5Fopen((this->simname + ".h5").c_str(), H5F_ACC_RDONLY, H5P_DEFAULT);
     this->niter_part = hdf5_tools::read_value<int>(parameter_file, "parameters/niter_part");
diff --git a/bfps/cpp/full_code/NSVEp_extra_sampling.cpp b/bfps/cpp/full_code/NSVEp_extra_sampling.cpp
index 3d002d34..22357510 100644
--- a/bfps/cpp/full_code/NSVEp_extra_sampling.cpp
+++ b/bfps/cpp/full_code/NSVEp_extra_sampling.cpp
@@ -5,6 +5,7 @@
 template <typename rnumber>
 int NSVEp_extra_sampling<rnumber>::initialize(void)
 {
+    TIMEZONE("NSVEp_extra_sampling::initialize");
     this->NSVEparticles<rnumber>::initialize();
 
     /// allocate grad vel field
@@ -30,6 +31,7 @@ int NSVEp_extra_sampling<rnumber>::initialize(void)
 template <typename rnumber>
 int NSVEp_extra_sampling<rnumber>::finalize(void)
 {
+    TIMEZONE("NSVEp_extra_sampling::finalize");
     delete this->nabla_u;
     delete this->pressure;
     delete this->nabla_p;
@@ -41,6 +43,7 @@ int NSVEp_extra_sampling<rnumber>::finalize(void)
 template <typename rnumber>
 int NSVEp_extra_sampling<rnumber>::do_stats()
 {
+    TIMEZONE("NSVEp_extra_sampling::do_stats");
     this->NSVEparticles<rnumber>::do_stats();
     if (!(this->iteration % this->niter_part == 0))
         return EXIT_SUCCESS;
diff --git a/bfps/cpp/full_code/NSVEparticles.cpp b/bfps/cpp/full_code/NSVEparticles.cpp
index 78f3d6a0..b09e3280 100644
--- a/bfps/cpp/full_code/NSVEparticles.cpp
+++ b/bfps/cpp/full_code/NSVEparticles.cpp
@@ -1,3 +1,6 @@
+
+
+
 #include <string>
 #include <cmath>
 #include "NSVEparticles.hpp"
@@ -6,6 +9,7 @@
 template <typename rnumber>
 int NSVEparticles<rnumber>::initialize(void)
 {
+    TIMEZONE("NSVEparticles::intialize");
     this->NSVE<rnumber>::initialize();
     this->pressure = new field<rnumber, FFTW, ONE>(
             this->fs->cvelocity->rlayout->sizes[2],
@@ -45,6 +49,7 @@ int NSVEparticles<rnumber>::initialize(void)
 template <typename rnumber>
 int NSVEparticles<rnumber>::step(void)
 {
+    TIMEZONE("NSVEparticles::step");
     this->fs->compute_velocity(this->fs->cvorticity);
     this->fs->cvelocity->ift();
     this->ps->completeLoop(this->dt);
@@ -55,6 +60,7 @@ int NSVEparticles<rnumber>::step(void)
 template <typename rnumber>
 int NSVEparticles<rnumber>::write_checkpoint(void)
 {
+    TIMEZONE("NSVEparticles::write_checkpoint");
     this->NSVE<rnumber>::write_checkpoint();
     this->particles_output_writer_mpi->open_file(this->fs->get_current_fname());
     this->particles_output_writer_mpi->template save<3>(
@@ -70,6 +76,7 @@ int NSVEparticles<rnumber>::write_checkpoint(void)
 template <typename rnumber>
 int NSVEparticles<rnumber>::finalize(void)
 {
+    TIMEZONE("NSVEparticles::finalize");
     delete this->pressure;
     this->ps.release();
     delete this->particles_output_writer_mpi;
@@ -84,6 +91,7 @@ int NSVEparticles<rnumber>::finalize(void)
 template <typename rnumber>
 int NSVEparticles<rnumber>::do_stats()
 {
+    TIMEZONE("NSVEparticles::do_stats");
     /// fluid stats go here
     this->NSVE<rnumber>::do_stats();
 
@@ -145,6 +153,7 @@ int NSVEparticles<rnumber>::do_stats()
 template <typename rnumber>
 int NSVEparticles<rnumber>::read_parameters(void)
 {
+    TIMEZONE("NSVEparticles::read_parameters");
     this->NSVE<rnumber>::read_parameters();
     hid_t parameter_file = H5Fopen((this->simname + ".h5").c_str(), H5F_ACC_RDONLY, H5P_DEFAULT);
     this->niter_part = hdf5_tools::read_value<int>(parameter_file, "parameters/niter_part");
diff --git a/bfps/cpp/full_code/NSVEparticles_no_output.hpp b/bfps/cpp/full_code/NSVEparticles_no_output.hpp
index d3d40139..5b9d5e15 100644
--- a/bfps/cpp/full_code/NSVEparticles_no_output.hpp
+++ b/bfps/cpp/full_code/NSVEparticles_no_output.hpp
@@ -16,7 +16,8 @@ class NSVEparticles_no_output: public NSVEparticles<rnumber>
     ~NSVEparticles_no_output(){}
     int write_checkpoint(void)
     {
-        return 0;
+        TIMEZONE("NSVEparticles_no_output::write_checkpoint");
+        return EXIT_SUCCESS;
     }
 };
 
diff --git a/bfps/cpp/full_code/code_base.cpp b/bfps/cpp/full_code/code_base.cpp
index 32fe9c1c..a6487c72 100644
--- a/bfps/cpp/full_code/code_base.cpp
+++ b/bfps/cpp/full_code/code_base.cpp
@@ -1,12 +1,42 @@
+/**********************************************************************
+*                                                                     *
+*  Copyright 2017 Max Planck Institute                                *
+*                 for Dynamics and Self-Organization                  *
+*                                                                     *
+*  This file is part of bfps.                                         *
+*                                                                     *
+*  bfps is free software: you can redistribute it and/or modify       *
+*  it under the terms of the GNU General Public License as published  *
+*  by the Free Software Foundation, either version 3 of the License,  *
+*  or (at your option) any later version.                             *
+*                                                                     *
+*  bfps is distributed in the hope that it will be useful,            *
+*  but WITHOUT ANY WARRANTY; without even the implied warranty of     *
+*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the      *
+*  GNU General Public License for more details.                       *
+*                                                                     *
+*  You should have received a copy of the GNU General Public License  *
+*  along with bfps.  If not, see <http://www.gnu.org/licenses/>       *
+*                                                                     *
+* Contact: Cristian.Lalescu@ds.mpg.de                                 *
+*                                                                     *
+**********************************************************************/
+
+
+
+#define NDEBUG
+
 #include "code_base.hpp"
 #include "scope_timer.hpp"
 
+
 code_base::code_base(
         const MPI_Comm COMMUNICATOR,
         const std::string &simulation_name):
     comm(COMMUNICATOR),
     simname(simulation_name)
 {
+    TIMEZONE("code_base::code_base");
     MPI_Comm_rank(this->comm, &this->myrank);
     MPI_Comm_size(this->comm, &this->nprocs);
     this->stop_code_now = false;
@@ -14,6 +44,7 @@ code_base::code_base(
 
 int code_base::check_stopping_condition(void)
 {
+    TIMEZONE("code_base::check_stopping_condition");
     if (myrank == 0)
     {
         std::string fname = (
@@ -36,6 +67,7 @@ int code_base::check_stopping_condition(void)
 
 int code_base::read_parameters(void)
 {
+    TIMEZONE("code_base::read_parameters");
     hid_t parameter_file = H5Fopen((this->simname + ".h5").c_str(), H5F_ACC_RDONLY, H5P_DEFAULT);
     this->dkx = hdf5_tools::read_value<double>(parameter_file, "parameters/dkx");
     this->dky = hdf5_tools::read_value<double>(parameter_file, "parameters/dky");
diff --git a/bfps/cpp/full_code/direct_numerical_simulation.cpp b/bfps/cpp/full_code/direct_numerical_simulation.cpp
index f763cde9..c0b0441e 100644
--- a/bfps/cpp/full_code/direct_numerical_simulation.cpp
+++ b/bfps/cpp/full_code/direct_numerical_simulation.cpp
@@ -8,6 +8,7 @@
 
 int direct_numerical_simulation::grow_file_datasets()
 {
+    TIMEZONE("direct_numerical_simulation::grow_file_datasets");
     return hdf5_tools::grow_file_datasets(
             this->stat_file,
             "statistics",
@@ -16,6 +17,7 @@ int direct_numerical_simulation::grow_file_datasets()
 
 int direct_numerical_simulation::read_iteration(void)
 {
+    TIMEZONE("direct_numerical_simulation::read_iteration");
     /* read iteration */
     hid_t dset;
     hid_t iteration_file = H5Fopen(
@@ -56,6 +58,7 @@ int direct_numerical_simulation::read_iteration(void)
 
 int direct_numerical_simulation::write_iteration(void)
 {
+    TIMEZONE("direct_numerical_simulation::write_iteration");
     if (this->myrank == 0)
     {
         hid_t dset = H5Dopen(
@@ -88,6 +91,7 @@ int direct_numerical_simulation::write_iteration(void)
 
 int direct_numerical_simulation::main_loop(void)
 {
+    TIMEZONE("direct_numerical_simulation::main_loop");
     this->start_simple_timer();
     int max_iter = (this->iteration + this->niter_todo -
                     (this->iteration % this->niter_todo));
@@ -119,6 +123,7 @@ int direct_numerical_simulation::main_loop(void)
 
 int direct_numerical_simulation::read_parameters(void)
 {
+    TIMEZONE("direct_numerical_simulation::read_parameters");
     this->code_base::read_parameters();
     hid_t parameter_file = H5Fopen((this->simname + ".h5").c_str(), H5F_ACC_RDONLY, H5P_DEFAULT);
     this->checkpoints_per_file = hdf5_tools::read_value<int>(parameter_file, "parameters/checkpoints_per_file");
diff --git a/bfps/cpp/full_code/field_output_test.cpp b/bfps/cpp/full_code/field_output_test.cpp
index f5440064..30df4e75 100644
--- a/bfps/cpp/full_code/field_output_test.cpp
+++ b/bfps/cpp/full_code/field_output_test.cpp
@@ -8,6 +8,7 @@
 template <typename rnumber>
 int field_output_test<rnumber>::initialize(void)
 {
+    TIMEZONE("field_output_test::initialize");
     this->read_parameters();
     return EXIT_SUCCESS;
 }
@@ -15,12 +16,14 @@ int field_output_test<rnumber>::initialize(void)
 template <typename rnumber>
 int field_output_test<rnumber>::finalize(void)
 {
+    TIMEZONE("field_output_test::finalize");
     return EXIT_SUCCESS;
 }
 
 template <typename rnumber>
 int field_output_test<rnumber>::read_parameters()
 {
+    TIMEZONE("field_output_test::read_parameters");
     this->test::read_parameters();
     return EXIT_SUCCESS;
 }
@@ -28,6 +31,7 @@ int field_output_test<rnumber>::read_parameters()
 template <typename rnumber>
 int field_output_test<rnumber>::do_work(void)
 {
+    TIMEZONE("field_output_test::do_work");
     // allocate
     field<rnumber, FFTW, ONE> *scal_field = new field<rnumber, FFTW, ONE>(
             this->nx, this->ny, this->nz,
diff --git a/bfps/cpp/full_code/field_single_to_double.cpp b/bfps/cpp/full_code/field_single_to_double.cpp
index bb34abd2..92976ecf 100644
--- a/bfps/cpp/full_code/field_single_to_double.cpp
+++ b/bfps/cpp/full_code/field_single_to_double.cpp
@@ -7,6 +7,7 @@
 template <typename rnumber>
 int field_single_to_double<rnumber>::initialize(void)
 {
+    TIMEZONE("field_single_to_double::intialize");
     this->NSVE_field_stats<rnumber>::initialize();
     DEBUG_MSG("after NSVE_field_stats::initialize\n");
     this->kk = new kspace<FFTW, SMOOTH>(
@@ -47,7 +48,7 @@ int field_single_to_double<rnumber>::initialize(void)
 template <typename rnumber>
 int field_single_to_double<rnumber>::work_on_current_iteration(void)
 {
-    DEBUG_MSG("entered field_single_to_double::work_on_current_iteration\n");
+    TIMEZONE("field_single_to_double::work_on_current_iteration");
     this->read_current_cvorticity();
 
     // using CLOOP as opposed to a global std::copy because CLOOP
@@ -83,6 +84,7 @@ int field_single_to_double<rnumber>::work_on_current_iteration(void)
 template <typename rnumber>
 int field_single_to_double<rnumber>::finalize(void)
 {
+    TIMEZONE("field_single_to_double::finalize");
     delete this->vec_field_double;
     delete this->kk;
     return EXIT_SUCCESS;
diff --git a/bfps/cpp/full_code/field_test.cpp b/bfps/cpp/full_code/field_test.cpp
index 5c323e54..1627bc40 100644
--- a/bfps/cpp/full_code/field_test.cpp
+++ b/bfps/cpp/full_code/field_test.cpp
@@ -8,6 +8,7 @@
 template <typename rnumber>
 int field_test<rnumber>::initialize(void)
 {
+    TIMEZONE("field_test::initialize");
     this->read_parameters();
     return EXIT_SUCCESS;
 }
@@ -15,23 +16,22 @@ int field_test<rnumber>::initialize(void)
 template <typename rnumber>
 int field_test<rnumber>::finalize(void)
 {
+    TIMEZONE("field_test::finalize");
+    this->read_parameters();
     return EXIT_SUCCESS;
 }
 
 template <typename rnumber>
 int field_test<rnumber>::read_parameters()
 {
+    TIMEZONE("field_test::read_parameters");
     this->test::read_parameters();
     // in case any parameters are needed, this is where they should be read
-    hid_t parameter_file;
-    hid_t dset;
-    parameter_file = H5Fopen(
+    hid_t parameter_file = H5Fopen(
             (this->simname + std::string(".h5")).c_str(),
             H5F_ACC_RDONLY,
             H5P_DEFAULT);
-    dset = H5Dopen(parameter_file, "/parameters/filter_length", H5P_DEFAULT);
-    H5Dread(dset, H5T_NATIVE_DOUBLE, H5S_ALL, H5S_ALL, H5P_DEFAULT, &this->filter_length);
-    H5Dclose(dset);
+    this->filter_length = hdf5_tools::read_value<double>(parameter_file, "/parameters/filter_length");
     H5Fclose(parameter_file);
     return EXIT_SUCCESS;
 }
@@ -39,6 +39,7 @@ int field_test<rnumber>::read_parameters()
 template <typename rnumber>
 int field_test<rnumber>::do_work(void)
 {
+    TIMEZONE("field_test::do_work");
     // allocate
     field<rnumber, FFTW, ONE> *scal_field = new field<rnumber, FFTW, ONE>(
             this->nx, this->ny, this->nz,
diff --git a/bfps/cpp/full_code/filter_test.cpp b/bfps/cpp/full_code/filter_test.cpp
index 80c4f83d..4db13843 100644
--- a/bfps/cpp/full_code/filter_test.cpp
+++ b/bfps/cpp/full_code/filter_test.cpp
@@ -7,6 +7,7 @@
 template <typename rnumber>
 int filter_test<rnumber>::initialize(void)
 {
+    TIMEZONE("filter_test::initialize");
     this->read_parameters();
     this->scal_field = new field<rnumber, FFTW, ONE>(
             nx, ny, nz,
@@ -30,6 +31,7 @@ int filter_test<rnumber>::initialize(void)
 template <typename rnumber>
 int filter_test<rnumber>::finalize(void)
 {
+    TIMEZONE("filter_test::finalize");
     delete this->scal_field;
     delete this->kk;
     return EXIT_SUCCESS;
@@ -38,16 +40,13 @@ int filter_test<rnumber>::finalize(void)
 template <typename rnumber>
 int filter_test<rnumber>::read_parameters()
 {
+    TIMEZONE("filter_test::read_parameters");
     this->test::read_parameters();
-    hid_t parameter_file;
-    hid_t dset;
-    parameter_file = H5Fopen(
+    hid_t parameter_file = H5Fopen(
             (this->simname + std::string(".h5")).c_str(),
             H5F_ACC_RDONLY,
             H5P_DEFAULT);
-    dset = H5Dopen(parameter_file, "/parameters/filter_length", H5P_DEFAULT);
-    H5Dread(dset, H5T_NATIVE_DOUBLE, H5S_ALL, H5S_ALL, H5P_DEFAULT, &this->filter_length);
-    H5Dclose(dset);
+    this->filter_length = hdf5_tools::read_value<double>(parameter_file, "/parameters/filter_length");
     H5Fclose(parameter_file);
     return EXIT_SUCCESS;
 }
@@ -56,6 +55,7 @@ template <typename rnumber>
 int filter_test<rnumber>::reset_field(
         int dimension)
 {
+    TIMEZONE("filter_test::reset_field");
     this->scal_field->real_space_representation = true;
     *this->scal_field = 0.0;
     if (this->scal_field->rlayout->starts[0] == 0)
@@ -95,6 +95,7 @@ int filter_test<rnumber>::reset_field(
 template <typename rnumber>
 int filter_test<rnumber>::do_work(void)
 {
+    TIMEZONE("filter_test::do_work");
     std::string filename = this->simname + std::string("_fields.h5");
     for (int dimension = 0; dimension < 3; dimension++)
     {
diff --git a/bfps/cpp/full_code/get_rfields.cpp b/bfps/cpp/full_code/get_rfields.cpp
index 3986b5f9..5d872b72 100644
--- a/bfps/cpp/full_code/get_rfields.cpp
+++ b/bfps/cpp/full_code/get_rfields.cpp
@@ -7,6 +7,7 @@
 template <typename rnumber>
 int get_rfields<rnumber>::initialize(void)
 {
+    TIMEZONE("get_rfields::initialize");
     this->NSVE_field_stats<rnumber>::initialize();
     DEBUG_MSG("after NSVE_field_stats::initialize\n");
     this->kk = new kspace<FFTW, SMOOTH>(
@@ -42,7 +43,7 @@ int get_rfields<rnumber>::initialize(void)
 template <typename rnumber>
 int get_rfields<rnumber>::work_on_current_iteration(void)
 {
-    DEBUG_MSG("entered get_rfields::work_on_current_iteration\n");
+    TIMEZONE("get_rfields::work_on_current_iteration");
     this->read_current_cvorticity();
     field<rnumber, FFTW, THREE> *vel = new field<rnumber, FFTW, THREE>(
             this->nx, this->ny, this->nz,
@@ -97,6 +98,7 @@ int get_rfields<rnumber>::work_on_current_iteration(void)
 template <typename rnumber>
 int get_rfields<rnumber>::finalize(void)
 {
+    TIMEZONE("get_rfields::finalize");
     delete this->kk;
     this->NSVE_field_stats<rnumber>::finalize();
     return EXIT_SUCCESS;
diff --git a/bfps/cpp/full_code/joint_acc_vel_stats.cpp b/bfps/cpp/full_code/joint_acc_vel_stats.cpp
index e4f4d5d4..1c28527e 100644
--- a/bfps/cpp/full_code/joint_acc_vel_stats.cpp
+++ b/bfps/cpp/full_code/joint_acc_vel_stats.cpp
@@ -7,6 +7,7 @@
 template <typename rnumber>
 int joint_acc_vel_stats<rnumber>::initialize(void)
 {
+    TIMEZONE("joint_acc_vel_stats::initialize");
     this->NSVE_field_stats<rnumber>::initialize();
     this->kk = new kspace<FFTW, SMOOTH>(
             this->vorticity->clayout, this->dkx, this->dky, this->dkz);
@@ -85,7 +86,7 @@ int joint_acc_vel_stats<rnumber>::initialize(void)
 template <typename rnumber>
 int joint_acc_vel_stats<rnumber>::work_on_current_iteration(void)
 {
-    DEBUG_MSG("entered joint_acc_vel_stats::work_on_current_iteration\n");
+    TIMEZONE("joint_acc_vel_stats::work_on_current_iteration");
     /// read current vorticity, place it in this->ve->cvorticity
     this->read_current_cvorticity();
     *this->ve->cvorticity = this->vorticity->get_cdata();
@@ -156,6 +157,7 @@ int joint_acc_vel_stats<rnumber>::work_on_current_iteration(void)
 template <typename rnumber>
 int joint_acc_vel_stats<rnumber>::finalize(void)
 {
+    DEBUG_MSG("entered joint_acc_vel_stats::finalize\n");
     delete this->ve;
     delete this->kk;
     if (this->myrank == 0)
diff --git a/bfps/cpp/full_code/native_binary_to_hdf5.cpp b/bfps/cpp/full_code/native_binary_to_hdf5.cpp
index 7774e2de..fb5a39c2 100644
--- a/bfps/cpp/full_code/native_binary_to_hdf5.cpp
+++ b/bfps/cpp/full_code/native_binary_to_hdf5.cpp
@@ -7,6 +7,7 @@
 template <typename rnumber>
 int native_binary_to_hdf5<rnumber>::initialize(void)
 {
+    TIMEZONE("native_binary_to_hdf5::initialize");
     this->read_parameters();
     this->vec_field = new field<rnumber, FFTW, THREE>(
             nx, ny, nz,
@@ -24,6 +25,7 @@ int native_binary_to_hdf5<rnumber>::initialize(void)
 template <typename rnumber>
 int native_binary_to_hdf5<rnumber>::work_on_current_iteration(void)
 {
+    TIMEZONE("native_binary_to_hdf5::work_on_current_iteration");
     char itername[16];
     sprintf(itername, "i%.5x", this->iteration);
     std::string native_binary_fname = (
@@ -45,6 +47,7 @@ int native_binary_to_hdf5<rnumber>::work_on_current_iteration(void)
 template <typename rnumber>
 int native_binary_to_hdf5<rnumber>::finalize(void)
 {
+    TIMEZONE("native_binary_to_hdf5::finalize");
     delete this->bin_IO;
     delete this->vec_field;
     return EXIT_SUCCESS;
@@ -53,6 +56,7 @@ int native_binary_to_hdf5<rnumber>::finalize(void)
 template <typename rnumber>
 int native_binary_to_hdf5<rnumber>::read_parameters(void)
 {
+    TIMEZONE("native_binary_to_hdf5::read_parameters");
     this->postprocess::read_parameters();
     hid_t parameter_file = H5Fopen(
             (this->simname + std::string(".h5")).c_str(),
diff --git a/bfps/cpp/full_code/postprocess.cpp b/bfps/cpp/full_code/postprocess.cpp
index 430d87a5..13bee700 100644
--- a/bfps/cpp/full_code/postprocess.cpp
+++ b/bfps/cpp/full_code/postprocess.cpp
@@ -8,6 +8,7 @@
 
 int postprocess::main_loop(void)
 {
+    TIMEZONE("postprocess::main_loop");
     this->start_simple_timer();
     for (unsigned int iteration_counter = 0;
          iteration_counter < iteration_list.size();
@@ -33,6 +34,7 @@ int postprocess::main_loop(void)
 
 int postprocess::read_parameters()
 {
+    TIMEZONE("postprocess::read_parameters");
     this->code_base::read_parameters();
     hid_t parameter_file = H5Fopen((this->simname + ".h5").c_str(), H5F_ACC_RDONLY, H5P_DEFAULT);
     this->nu = hdf5_tools::read_value<double>(parameter_file, "parameters/nu");
diff --git a/bfps/cpp/full_code/resize.cpp b/bfps/cpp/full_code/resize.cpp
index 41d68ef7..de555a74 100644
--- a/bfps/cpp/full_code/resize.cpp
+++ b/bfps/cpp/full_code/resize.cpp
@@ -7,6 +7,7 @@
 template <typename rnumber>
 int resize<rnumber>::initialize(void)
 {
+    TIMEZONE("resize::initialize");
     this->NSVE_field_stats<rnumber>::initialize();
     DEBUG_MSG("after NSVE_field_stats::initialize\n");
     hid_t parameter_file = H5Fopen(
@@ -46,7 +47,7 @@ int resize<rnumber>::initialize(void)
 template <typename rnumber>
 int resize<rnumber>::work_on_current_iteration(void)
 {
-    DEBUG_MSG("entered resize::work_on_current_iteration\n");
+    TIMEZONE("resize::work_on_current_iteration");
     this->read_current_cvorticity();
 
     std::string fname = (
@@ -64,6 +65,7 @@ int resize<rnumber>::work_on_current_iteration(void)
 template <typename rnumber>
 int resize<rnumber>::finalize(void)
 {
+    TIMEZONE("resize::finalize");
     delete this->new_field;
     this->NSVE_field_stats<rnumber>::finalize();
     return EXIT_SUCCESS;
diff --git a/bfps/cpp/full_code/symmetrize_test.cpp b/bfps/cpp/full_code/symmetrize_test.cpp
index 3b4cd5a5..821161da 100644
--- a/bfps/cpp/full_code/symmetrize_test.cpp
+++ b/bfps/cpp/full_code/symmetrize_test.cpp
@@ -8,6 +8,7 @@
 template <typename rnumber>
 int symmetrize_test<rnumber>::initialize(void)
 {
+    TIMEZONE("symmetrize_test::initialize");
     this->read_parameters();
     return EXIT_SUCCESS;
 }
@@ -15,12 +16,14 @@ int symmetrize_test<rnumber>::initialize(void)
 template <typename rnumber>
 int symmetrize_test<rnumber>::finalize(void)
 {
+    TIMEZONE("symmetrize_test::finalize");
     return EXIT_SUCCESS;
 }
 
 template <typename rnumber>
 int symmetrize_test<rnumber>::read_parameters()
 {
+    TIMEZONE("symmetrize_test::read_parameters");
     this->test::read_parameters();
     hid_t parameter_file = H5Fopen(
             (this->simname + std::string(".h5")).c_str(),
@@ -35,6 +38,7 @@ int symmetrize_test<rnumber>::read_parameters()
 template <typename rnumber>
 int symmetrize_test<rnumber>::do_work(void)
 {
+    TIMEZONE("symmetrize_test::do_work");
     // allocate
     DEBUG_MSG("about to allocate field0\n");
     field<rnumber, FFTW, THREE> *test_field0 = new field<rnumber, FFTW, THREE>(
diff --git a/bfps/cpp/full_code/test.cpp b/bfps/cpp/full_code/test.cpp
index e382efb4..aa909362 100644
--- a/bfps/cpp/full_code/test.cpp
+++ b/bfps/cpp/full_code/test.cpp
@@ -8,9 +8,7 @@
 
 int test::main_loop(void)
 {
-    #ifdef USE_TIMINGOUTPUT
-        TIMEZONE("test::main_loop");
-    #endif
+    TIMEZONE("test::main_loop");
     this->start_simple_timer();
     this->do_work();
     this->print_simple_timer(
diff --git a/bfps/cpp/full_code/test_interpolation.cpp b/bfps/cpp/full_code/test_interpolation.cpp
index b194d372..5ef11de4 100644
--- a/bfps/cpp/full_code/test_interpolation.cpp
+++ b/bfps/cpp/full_code/test_interpolation.cpp
@@ -4,6 +4,7 @@
 template <typename rnumber>
 int test_interpolation<rnumber>::read_parameters(void)
 {
+    TIMEZONE("test_interpolation::read_parameters");
     this->test::read_parameters();
     hid_t parameter_file = H5Fopen(
             (this->simname + std::string(".h5")).c_str(),
@@ -24,6 +25,7 @@ int test_interpolation<rnumber>::read_parameters(void)
 template <typename rnumber>
 int test_interpolation<rnumber>::initialize(void)
 {
+    TIMEZONE("test_interpolation::initialize");
     this->read_parameters();
     this->vorticity = new field<rnumber, FFTW, THREE>(
             this->nx, this->ny, this->nz,
@@ -86,6 +88,7 @@ int test_interpolation<rnumber>::initialize(void)
 template <typename rnumber>
 int test_interpolation<rnumber>::finalize(void)
 {
+    TIMEZONE("test_interpolation::finalize");
     delete this->nabla_u;
     delete this->velocity;
     delete this->vorticity;
@@ -99,6 +102,7 @@ int test_interpolation<rnumber>::finalize(void)
 template <typename rnumber>
 int test_interpolation<rnumber>::do_work()
 {
+    TIMEZONE("test_interpolation::do_work");
     *this->nabla_u = 0.0;
     this->velocity->real_space_representation = false;
     this->vorticity->real_space_representation = false;
diff --git a/bfps/cpp/scope_timer.hpp b/bfps/cpp/scope_timer.hpp
index 2c48e2ed..890f522c 100644
--- a/bfps/cpp/scope_timer.hpp
+++ b/bfps/cpp/scope_timer.hpp
@@ -791,7 +791,8 @@ extern EventManager global_timer_manager;
 
 #define TIMEZONE(NAME)                                                      \
   ScopeEvent TIMEZONE_Core_Pre_Merge(____TIMEZONE_AUTO_ID, __LINE__)( \
-      NAME, global_timer_manager, ScopeEventUniqueKey);
+      NAME, global_timer_manager, ScopeEventUniqueKey); \
+  DEBUG_MSG((NAME + std::string("\n")).c_str());
 #define TIMEZONE_MULTI_REF(NAME)                                            \
   ScopeEvent TIMEZONE_Core_Pre_Merge(____TIMEZONE_AUTO_ID, __LINE__)( \
       NAME, global_timer_manager, ScopeEventMultiRefKey);
-- 
GitLab