Skip to content

Commit

Permalink
Add a message about how the timers work to run_timing.log
Browse files Browse the repository at this point in the history
Refactor of Time::Print_Average_Times to ease future additions to the header
  • Loading branch information
bcaddy committed Aug 24, 2023
1 parent da283ee commit 0f9c8b0
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions src/utils/timing_functions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -150,14 +150,15 @@ 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 timers all skip the first time step since it always takes longer." + std::string("\n") +
"To find the average time divide the time shown by n_steps-1" + 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 +187,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 0f9c8b0

Please sign in to comment.