Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
mpim-sw
cdo
Commits
380b2633
Commit
380b2633
authored
Dec 17, 2020
by
Uwe Schulzweida
Browse files
getMaxMemString(): cleanup.
parent
af8895f8
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/cdo.cc
View file @
380b2633
...
...
@@ -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
,
'/'
);
...
...
src/process.cc
View file @
380b2633
...
...
@@ -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
));
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment