Skip to content

Commit

Permalink
Refactor of Time::Print_Average_Times to ease future additions
Browse files Browse the repository at this point in the history
  • Loading branch information
bcaddy committed Aug 24, 2023
1 parent caa659d commit 09bf6a0
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions src/utils/timing_functions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -150,14 +150,14 @@ void Time::Print_Average_Times(struct parameters P)
}

std::string file_name("run_timing.log");
std::string header;

chprintf("Writing timing values to file: %s \n", file_name.c_str());

std::string gitHash = "Git Commit Hash = " + std::string(GIT_HASH) + std::string("\n");
std::string macroFlags = "Macro Flags = " + std::string(MACRO_FLAGS) + std::string("\n\n");
std::string header = "Git Commit Hash = " + std::string(GIT_HASH) + std::string("\n");
header += "Macro Flags = " + std::string(MACRO_FLAGS) + std::string("\n");
header += "Note that the Hydro_Integrator timer is averaged over all but the first time step" + std::string("\n");

header = "#n_proc nx ny nz n_omp n_steps ";
header += std::string("\n") + "#n_proc nx ny nz n_omp n_steps ";

for (OneTime* x : onetimes) {
header += x->name;
Expand Down Expand Up @@ -186,8 +186,6 @@ void Time::Print_Average_Times(struct parameters P)
// Output timing values
out_file.open(file_name.c_str(), std::ios::app);
if (!file_exists) {
out_file << gitHash;
out_file << macroFlags;
out_file << header;
}
#ifdef MPI_CHOLLA
Expand Down

0 comments on commit 09bf6a0

Please sign in to comment.