The old call signature and lack of documentation of this function made
it easy to misuse, and (e.g.) mdrun was reporting the same initial and
final time stamp. Fixed signature and documented.
Change-Id: Ib4d9a07bc6e1165affa3bfdf7cd3b54c615d4765
void print_time(FILE *out, gmx_walltime_accounting_t walltime_accounting,
gmx_int64_t step, t_inputrec *ir, t_commrec *cr);
void print_time(FILE *out, gmx_walltime_accounting_t walltime_accounting,
gmx_int64_t step, t_inputrec *ir, t_commrec *cr);
-void print_date_and_time(FILE *log, int pid, const char *title,
- const gmx_walltime_accounting_t walltime_accounting);
+/*! \brief Print date, time, MPI rank and a description of this point
+ * in time.
+ *
+ * \param[in] log logfile, or NULL to suppress output
+ * \param[in] nodeid MPI rank to include in the output
+ * \param[in] title Description to include in the output
+ * \param[in] the_time Seconds since the epoch, e.g. as reported by gmx_gettime
+ */
+void print_date_and_time(FILE *log, int rank, const char *title,
+ double the_time);
void print_start(FILE *fplog, t_commrec *cr,
gmx_walltime_accounting_t walltime_accounting,
void print_start(FILE *fplog, t_commrec *cr,
gmx_walltime_accounting_t walltime_accounting,
}
void print_date_and_time(FILE *fplog, int nodeid, const char *title,
}
void print_date_and_time(FILE *fplog, int nodeid, const char *title,
- const gmx_walltime_accounting_t walltime_accounting)
- int i;
- char timebuf[STRLEN];
char time_string[STRLEN];
char time_string[STRLEN];
- if (walltime_accounting != NULL)
- {
- tmptime = (time_t) walltime_accounting_get_start_time_stamp(walltime_accounting);
- gmx_ctime_r(&tmptime, timebuf, STRLEN);
- }
- else
- {
- tmptime = (time_t) gmx_gettime();
- gmx_ctime_r(&tmptime, timebuf, STRLEN);
- }
+ return;
+ }
+
+ {
+ int i;
+ char timebuf[STRLEN];
+ time_t temp_time = (time_t) the_time;
+
+ gmx_ctime_r(&temp_time, timebuf, STRLEN);
for (i = 0; timebuf[i] >= ' '; i++)
{
time_string[i] = timebuf[i];
}
time_string[i] = '\0';
for (i = 0; timebuf[i] >= ' '; i++)
{
time_string[i] = timebuf[i];
}
time_string[i] = '\0';
-
- fprintf(fplog, "%s on node %d %s\n", title, nodeid, time_string);
+
+ fprintf(fplog, "%s on node %d %s\n", title, nodeid, time_string);
}
void print_start(FILE *fplog, t_commrec *cr,
}
void print_start(FILE *fplog, t_commrec *cr,
char buf[STRLEN];
sprintf(buf, "Started %s", name);
char buf[STRLEN];
sprintf(buf, "Started %s", name);
- print_date_and_time(fplog, cr->nodeid, buf, walltime_accounting);
+ print_date_and_time(fplog, cr->nodeid, buf,
+ walltime_accounting_get_start_time_stamp(walltime_accounting));
}
static void sum_forces(int start, int end, rvec f[], rvec flr[])
}
static void sum_forces(int start, int end, rvec f[], rvec flr[])
*step_rel = 0;
wallcycle_start(wcycle, ewcRUN);
walltime_accounting_start(walltime_accounting);
*step_rel = 0;
wallcycle_start(wcycle, ewcRUN);
walltime_accounting_start(walltime_accounting);
- print_date_and_time(fplog, cr->nodeid, "Restarted time", walltime_accounting);
+ print_date_and_time(fplog, cr->nodeid, "Restarted time", gmx_gettime());
}
double do_md(FILE *fplog, t_commrec *cr, int nfile, const t_filenm fnm[],
}
double do_md(FILE *fplog, t_commrec *cr, int nfile, const t_filenm fnm[],
gmx_hardware_info_free(hwinfo);
/* Does what it says */
gmx_hardware_info_free(hwinfo);
/* Does what it says */
- print_date_and_time(fplog, cr->nodeid, "Finished mdrun", walltime_accounting);
+ print_date_and_time(fplog, cr->nodeid, "Finished mdrun", gmx_gettime());
walltime_accounting_destroy(walltime_accounting);
/* Close logfile already here if we were appending to it */
walltime_accounting_destroy(walltime_accounting);
/* Close logfile already here if we were appending to it */