Medusa
1.1
Coordinate Free Mehless Method implementation
memutils.cpp
Go to the documentation of this file.
1
#include <
medusa/bits/utils/memutils.hpp
>
2
8
namespace
mm
{
9
10
std::string
mem2str
(std::size_t bytes) {
11
double
amount = bytes;
12
std::vector<std::string> suffix = {
"B"
,
"kB"
,
"MB"
,
"GB"
};
13
for
(
int
i = 0; i < 4; ++i) {
14
if
(amount < 100) {
15
std::stringstream ss;
16
ss << static_cast<int>(amount*10+0.5) / 10.0 <<
" "
<< suffix[i];
17
return
ss.str();
18
}
19
amount /= 1000;
20
}
21
return
"More than your mem."
;
22
}
23
24
}
// namespace mm
mm
Root namespace for the whole library.
Definition:
Gaussian.hpp:14
memutils.hpp
mm::mem2str
std::string mem2str(std::size_t bytes)
Simple function to help format memory amounts for printing.
Definition:
memutils.cpp:10
src
utils
memutils.cpp
Generated on Thu Jun 9 2022 09:42:29 for Medusa by
1.8.17