diff --git a/common/memory.cc b/common/memory.cc index 9dae11c..279bb8f 100644 --- a/common/memory.cc +++ b/common/memory.cc @@ -16,6 +16,7 @@ * limitations under the License. */ +#include #include #include "memory.h" @@ -84,8 +85,9 @@ std::string mem_string( const MemoryStatus & mem_status, break; } default: // Default mode, just show the used/total memory in MB - oss << static_cast< unsigned int >( mem_status.used_mem ) << '/' - << static_cast< unsigned int >( mem_status.total_mem ) << "MB"; + if(mem_status.used_mem>100000 && mem_status.total_mem>100000) oss<(mem_status.used_mem/1024)<<"/"<(mem_status.total_mem/1024)<<"GB"; + else if(mem_status.used_mem<100000 && mem_status.total_mem>100000) oss<(mem_status.used_mem)<<"MB/"<(mem_status.total_mem/1024)<<"GB"; + else oss<(mem_status.used_mem)<<"/"<(mem_status.total_mem)<<"MB"; } if( use_colors )