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

getMaxMemString(): cleanup.

parent af8895f8
...@@ -1732,7 +1732,7 @@ const char * ...@@ -1732,7 +1732,7 @@ const char *
getProgname(char *string) getProgname(char *string)
{ {
#ifdef _WIN32 #ifdef _WIN32
/* progname = strrchr(string, '\\'); */ // progname = strrchr(string, '\\');
char *progname = " cdo"; char *progname = " cdo";
#else #else
char *progname = strrchr(string, '/'); char *progname = strrchr(string, '/');
......
...@@ -402,12 +402,7 @@ Process::run() ...@@ -402,12 +402,7 @@ Process::run()
void void
Process::printBenchmarks(double p_walltime, const char *p_memstring) 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);
if (m_ID == 0)
{
fprintf(stderr, " [%.2fs%s]", p_walltime, p_memstring);
}
#endif
} }
// local helper function // local helper function
...@@ -415,7 +410,7 @@ extern "C" size_t getPeakRSS(); ...@@ -415,7 +410,7 @@ extern "C" size_t getPeakRSS();
static void static void
getMaxMemString(char *p_memstring, size_t memstringLen) getMaxMemString(char *p_memstring, size_t memstringLen)
{ {
size_t memmax = getPeakRSS(); auto memmax = getPeakRSS();
if (memmax) if (memmax)
{ {
size_t muindex = 0; size_t muindex = 0;
...@@ -437,26 +432,18 @@ Process::printProcessedValues() ...@@ -437,26 +432,18 @@ Process::printProcessedValues()
fprintf(stderr, "%s: ", prompt); fprintf(stderr, "%s: ", prompt);
reset_text_color(stderr); reset_text_color(stderr);
const int64_t nvals = inqNvals(); const auto nvals = inqNvals();
if (nvals > 0) if (nvals > 0)
{ {
if (sizeof(int64_t) > sizeof(size_t)) fprintf(stderr, "Processed %zu value%s from %d variable%s", nvals, ADD_PLURAL(nvals), nvars, ADD_PLURAL(nvars));
#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));
} }
else if (nvars > 0) else if (nvars > 0)
{ {
fprintf(stderr, "Processed %d variable%s", nvars, ADD_PLURAL(nvars)); 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] = { "" }; char memstring[32] = { "" };
if (m_ID == 0) getMaxMemString(memstring, sizeof(memstring)); 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