Commit 380b2633 authored by Uwe Schulzweida's avatar Uwe Schulzweida
Browse files

getMaxMemString(): cleanup.

parent af8895f8
......@@ -1732,7 +1732,7 @@ const char *
getProgname(char *string)
{
#ifdef _WIN32
/* progname = strrchr(string, '\\'); */
// progname = strrchr(string, '\\');
char *progname = " cdo";
#else
char *progname = strrchr(string, '/');
......
......@@ -402,12 +402,7 @@ Process::run()
void
Process::printBenchmarks(double p_walltime, const char *p_memstring)
{
#ifdef HAVE_SYS_TIMES_H
if (m_ID == 0)
{
fprintf(stderr, " [%.2fs%s]", p_walltime, p_memstring);
}
#endif
if (m_ID == 0) fprintf(stderr, " [%.2fs%s]", p_walltime, p_memstring);
}
// local helper function
......@@ -415,7 +410,7 @@ extern "C" size_t getPeakRSS();
static void
getMaxMemString(char *p_memstring, size_t memstringLen)
{
size_t memmax = getPeakRSS();
auto memmax = getPeakRSS();
if (memmax)
{
size_t muindex = 0;
......@@ -437,26 +432,18 @@ Process::printProcessedValues()
fprintf(stderr, "%s: ", prompt);
reset_text_color(stderr);
const int64_t nvals = inqNvals();
const auto nvals = inqNvals();
if (nvals > 0)
{
if (sizeof(int64_t) > sizeof(size_t))
#ifdef _WIN32
fprintf(stderr, "Processed %I64d value%s from %d variable%s",
#else
fprintf(stderr, "Processed %jd value%s from %d variable%s",
#endif
(intmax_t) nvals, ADD_PLURAL(nvals), nvars, ADD_PLURAL(nvars));
else
fprintf(stderr, "Processed %zu value%s from %d variable%s", (size_t) nvals, ADD_PLURAL(nvals), nvars, ADD_PLURAL(nvars));
fprintf(stderr, "Processed %zu value%s from %d variable%s", nvals, ADD_PLURAL(nvals), nvars, ADD_PLURAL(nvars));
}
else if (nvars > 0)
{
fprintf(stderr, "Processed %d variable%s", nvars, ADD_PLURAL(nvars));
}
if (ntimesteps > 0) fprintf(stderr, " over %d timestep%s", ntimesteps, ADD_PLURAL(ntimesteps));
if ((nvals || nvars) && ntimesteps > 0) fprintf(stderr, " over %d timestep%s", ntimesteps, ADD_PLURAL(ntimesteps));
char memstring[32] = { "" };
if (m_ID == 0) getMaxMemString(memstring, sizeof(memstring));
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment