Commit a3263389 authored by Brad King's avatar Brad King Committed by Kitware Robot
Browse files

Merge topic 'drop-unused-code'

c4e8126a Drop unused CXX cstdio check
74daf33b Drop unused Borland and OpenWatcom preprocessor conditions
2b749749 Drop unused C type macros check
441dd494 Drop unused checks for 'long long' and '__int64'
a0bd892c

 SystemInformation: Use 'long long' unconditionally
Acked-by: Kitware Robot's avatarKitware Robot <kwrobot@kitware.com>
Merge-request: !192
parents e3b80eb3 c4e8126a
......@@ -359,39 +359,6 @@ endif()
# capabilities and parent project's request. Enforce 0/1 as only
# possible values for configuration into Configure.hxx.
# Check existence and uniqueness of long long and __int64.
KWSYS_PLATFORM_CXX_TEST(KWSYS_CXX_HAS_LONG_LONG
"Checking whether C++ compiler has 'long long'" DIRECT)
KWSYS_PLATFORM_CXX_TEST(KWSYS_CXX_HAS___INT64
"Checking whether C++ compiler has '__int64'" DIRECT)
if(KWSYS_CXX_HAS___INT64)
KWSYS_PLATFORM_CXX_TEST(KWSYS_CXX_SAME_LONG_AND___INT64
"Checking whether long and __int64 are the same type" DIRECT)
if(KWSYS_CXX_HAS_LONG_LONG)
KWSYS_PLATFORM_CXX_TEST(KWSYS_CXX_SAME_LONG_LONG_AND___INT64
"Checking whether long long and __int64 are the same type" DIRECT)
endif()
endif()
# Enable the "long long" type if it is available. It is standard in
# C99 and C++03 but not in earlier standards.
if(KWSYS_CXX_HAS_LONG_LONG)
set(KWSYS_USE_LONG_LONG 1)
else()
set(KWSYS_USE_LONG_LONG 0)
endif()
# Enable the "__int64" type if it is available and unique. It is not
# standard.
set(KWSYS_USE___INT64 0)
if(KWSYS_CXX_HAS___INT64)
if(NOT KWSYS_CXX_SAME_LONG_AND___INT64)
if(NOT KWSYS_CXX_SAME_LONG_LONG_AND___INT64)
set(KWSYS_USE___INT64 1)
endif()
endif()
endif()
if(KWSYS_USE_Encoding)
# Look for type size helper macros.
KWSYS_PLATFORM_CXX_TEST(KWSYS_STL_HAS_WSTRING
......@@ -546,24 +513,6 @@ if(KWSYS_USE_SystemInformation)
set_property(SOURCE SystemInformation.cxx APPEND PROPERTY
COMPILE_DEFINITIONS KWSYS_CXX_HAS_RLIMIT64=1)
endif()
KWSYS_PLATFORM_CXX_TEST(KWSYS_CXX_HAS_ATOL
"Checking whether CXX compiler has atol" DIRECT)
if(KWSYS_CXX_HAS_ATOL)
set_property(SOURCE SystemInformation.cxx APPEND PROPERTY
COMPILE_DEFINITIONS KWSYS_CXX_HAS_ATOL=1)
endif()
KWSYS_PLATFORM_CXX_TEST(KWSYS_CXX_HAS_ATOLL
"Checking whether CXX compiler has atoll" DIRECT)
if(KWSYS_CXX_HAS_ATOLL)
set_property(SOURCE SystemInformation.cxx APPEND PROPERTY
COMPILE_DEFINITIONS KWSYS_CXX_HAS_ATOLL=1)
endif()
KWSYS_PLATFORM_CXX_TEST(KWSYS_CXX_HAS__ATOI64
"Checking whether CXX compiler has _atoi64" DIRECT)
if(KWSYS_CXX_HAS__ATOI64)
set_property(SOURCE SystemInformation.cxx APPEND PROPERTY
COMPILE_DEFINITIONS KWSYS_CXX_HAS__ATOI64=1)
endif()
if(UNIX)
include(CheckIncludeFileCXX)
# check for simple stack trace
......@@ -627,28 +576,6 @@ if(KWSYS_USE_SystemInformation)
endif()
endif()
endif()
if(BORLAND)
KWSYS_PLATFORM_CXX_TEST(KWSYS_CXX_HAS_BORLAND_ASM
"Checking whether Borland CXX compiler supports assembler instructions" DIRECT)
if(KWSYS_CXX_HAS_BORLAND_ASM)
set_property(SOURCE SystemInformation.cxx APPEND PROPERTY
COMPILE_DEFINITIONS KWSYS_CXX_HAS_BORLAND_ASM=1)
KWSYS_PLATFORM_CXX_TEST(KWSYS_CXX_HAS_BORLAND_ASM_CPUID
"Checking whether Borland CXX compiler supports CPUID assembler instruction" DIRECT)
if(KWSYS_CXX_HAS_BORLAND_ASM_CPUID)
set_property(SOURCE SystemInformation.cxx APPEND PROPERTY
COMPILE_DEFINITIONS KWSYS_CXX_HAS_BORLAND_ASM_CPUID=1)
endif()
endif()
endif()
if(KWSYS_USE___INT64)
set_property(SOURCE SystemInformation.cxx testSystemInformation.cxx APPEND PROPERTY
COMPILE_DEFINITIONS KWSYS_USE___INT64=1)
endif()
if(KWSYS_USE_LONG_LONG)
set_property(SOURCE SystemInformation.cxx testSystemInformation.cxx APPEND PROPERTY
COMPILE_DEFINITIONS KWSYS_USE_LONG_LONG=1)
endif()
if(KWSYS_BUILD_SHARED)
set_property(SOURCE SystemInformation.cxx APPEND PROPERTY
COMPILE_DEFINITIONS KWSYS_BUILD_SHARED=1)
......
......@@ -13,9 +13,6 @@
/* Disable some warnings inside kwsys source files. */
#if defined(KWSYS_NAMESPACE)
# if defined(__BORLANDC__)
# pragma warn - 8027 /* function not inlined. */
# endif
# if defined(__INTEL_COMPILER)
# pragma warning(disable : 1572) /* floating-point equality test */
# endif
......@@ -68,11 +65,6 @@
# pragma warning(disable : 4710) /* function not inlined */
# pragma warning(disable : 4786) /* identifier truncated in debug info */
# endif
# if defined(__BORLANDC__) && !defined(__cplusplus)
/* Code has no effect; raised by winnt.h in C (not C++) when ignoring an
unused parameter using "(param)" syntax (i.e. no cast to void). */
# pragma warn - 8019
# endif
#endif
/* MSVC 6.0 in release mode will warn about code it produces with its
......
......@@ -92,26 +92,12 @@ void Directory::Clear()
# include <sys/stat.h>
# include <sys/types.h>
// Wide function names can vary depending on compiler:
# ifdef __BORLANDC__
# define _wfindfirst_func __wfindfirst
# define _wfindnext_func __wfindnext
# else
# define _wfindfirst_func _wfindfirst
# define _wfindnext_func _wfindnext
# endif
namespace KWSYS_NAMESPACE {
bool Directory::Load(const std::string& name, std::string* errorMessage)
{
this->Clear();
# if (defined(_MSC_VER) && _MSC_VER < 1300) || defined(__BORLANDC__)
// Older Visual C++ and Embarcadero compilers.
long srchHandle;
# else // Newer Visual C++
intptr_t srchHandle;
# endif
char* buf;
size_t n = name.size();
if (name.back() == '/' || name.back() == '\\') {
......@@ -130,8 +116,8 @@ bool Directory::Load(const std::string& name, std::string* errorMessage)
struct _wfinddata_t data; // data of current file
// Now put them into the file array
srchHandle = _wfindfirst_func(
(wchar_t*)Encoding::ToWindowsExtendedPath(buf).c_str(), &data);
srchHandle =
_wfindfirst((wchar_t*)Encoding::ToWindowsExtendedPath(buf).c_str(), &data);
delete[] buf;
if (srchHandle == -1) {
......@@ -141,7 +127,7 @@ bool Directory::Load(const std::string& name, std::string* errorMessage)
// Loop through names
do {
this->Internal->Files.push_back(Encoding::ToNarrow(data.name));
} while (_wfindnext_func(srchHandle, &data) != -1);
} while (_wfindnext(srchHandle, &data) != -1);
this->Internal->Path = name;
return _findclose(srchHandle) != -1;
}
......@@ -149,12 +135,7 @@ bool Directory::Load(const std::string& name, std::string* errorMessage)
unsigned long Directory::GetNumberOfFilesInDirectory(const std::string& name,
std::string* errorMessage)
{
# if (defined(_MSC_VER) && _MSC_VER < 1300) || defined(__BORLANDC__)
// Older Visual C++ and Embarcadero compilers.
long srchHandle;
# else // Newer Visual C++
intptr_t srchHandle;
# endif
char* buf;
size_t n = name.size();
if (name.back() == '/') {
......@@ -167,8 +148,7 @@ unsigned long Directory::GetNumberOfFilesInDirectory(const std::string& name,
struct _wfinddata_t data; // data of current file
// Now put them into the file array
srchHandle =
_wfindfirst_func((wchar_t*)Encoding::ToWide(buf).c_str(), &data);
srchHandle = _wfindfirst((wchar_t*)Encoding::ToWide(buf).c_str(), &data);
delete[] buf;
if (srchHandle == -1) {
......@@ -179,7 +159,7 @@ unsigned long Directory::GetNumberOfFilesInDirectory(const std::string& name,
unsigned long count = 0;
do {
count++;
} while (_wfindnext_func(srchHandle, &data) != -1);
} while (_wfindnext(srchHandle, &data) != -1);
_findclose(srchHandle);
return count;
}
......
......@@ -246,17 +246,6 @@ DynamicLoader::SymbolPointer DynamicLoader::GetSymbolAddress(
// should have a tool to help get the symbol with the desired
// calling convention. Currently we assume cdecl.
//
// Borland:
// __cdecl = "_func" (default)
// __fastcall = "@_func"
// __stdcall = "func"
//
// Watcom:
// __cdecl = "_func"
// __fastcall = "@_func@X"
// __stdcall = "_func@X"
// __watcall = "func_" (default)
//
// MSVC:
// __cdecl = "func" (default)
// __fastcall = "@_func@X"
......@@ -265,20 +254,9 @@ DynamicLoader::SymbolPointer DynamicLoader::GetSymbolAddress(
// Note that the "@X" part of the name above is the total size (in
// bytes) of the arguments on the stack.
void* result;
# if defined(__BORLANDC__) || defined(__WATCOMC__)
// Need to prepend symbols with '_'
std::string ssym = '_' + sym;
const char* rsym = ssym.c_str();
# else
const char* rsym = sym.c_str();
# endif
result = (void*)GetProcAddress(lib, rsym);
// Hack to cast pointer-to-data to pointer-to-function.
# ifdef __WATCOMC__
return *(DynamicLoader::SymbolPointer*)(&result);
# else
return *reinterpret_cast<DynamicLoader::SymbolPointer*>(&result);
# endif
}
# define DYNLOAD_ERROR_BUFFER_SIZE 1024
......
......@@ -31,9 +31,6 @@ a UNIX-style select system call.
#include <io.h> /* _unlink */
#include <stdio.h> /* sprintf */
#include <string.h> /* strlen, strdup */
#ifdef __WATCOMC__
# define _unlink unlink
#endif
#ifndef _MAX_FNAME
# define _MAX_FNAME 4096
......@@ -48,11 +45,6 @@ a UNIX-style select system call.
# pragma warning(disable : 4706)
#endif
#if defined(__BORLANDC__)
# pragma warn - 8004 /* assigned a value that is never used */
# pragma warn - 8060 /* Assignment inside if() condition. */
#endif
/* There are pipes for the process pipeline's stdout and stderr. */
#define KWSYSPE_PIPE_COUNT 2
#define KWSYSPE_PIPE_STDOUT 0
......
......@@ -26,12 +26,6 @@
#include <string>
/* Disable useless Borland warnings. KWSys tries not to force things
on its includers, but there is no choice here. */
#if defined(__BORLANDC__)
# pragma warn - 8027 /* function not inlined. */
#endif
namespace @KWSYS_NAMESPACE@ {
// Forward declaration
......
......@@ -66,12 +66,6 @@
# endif
# endif
# if defined(__BORLANDC__) && !defined(__cplusplus)
/* Code has no effect; raised by winnt.h in C (not C++) when ignoring an
unused parameter using "(param)" syntax (i.e. no cast to void). */
# pragma warn - 8019
# endif
/* Full path to the directory in which this executable is built. Do
not include a trailing slash. */
# if !defined(@KWSYS_NAMESPACE@_SHARED_FORWARD_DIR_BUILD)
......
......@@ -52,14 +52,6 @@ public:
}
}; // End Class: String
#if defined(__WATCOMC__)
inline bool operator<(String const& l, String const& r)
{
return (static_cast<std::string const&>(l) <
static_cast<std::string const&>(r));
}
#endif
} // namespace @KWSYS_NAMESPACE@
#endif
......@@ -169,18 +169,6 @@ typedef struct rlimit ResourceLimitType;
#include <cstring>
#include <memory.h>
#if defined(KWSYS_CXX_HAS_ATOLL)
# define atoLongLong atoll
#else
# if defined(KWSYS_CXX_HAS__ATOI64)
# define atoLongLong _atoi64
# elif defined(KWSYS_CXX_HAS_ATOL)
# define atoLongLong atol
# else
# define atoLongLong atoi
# endif
#endif
#if defined(_MSC_VER) && (_MSC_VER >= 1300) && !defined(_WIN64) && \
!defined(__clang__)
# define USE_ASM_INSTRUCTIONS 1
......@@ -196,8 +184,7 @@ typedef struct rlimit ResourceLimitType;
# define USE_CPUID_INTRINSICS 0
#endif
#if USE_ASM_INSTRUCTIONS || USE_CPUID_INTRINSICS || \
defined(KWSYS_CXX_HAS_BORLAND_ASM_CPUID)
#if USE_ASM_INSTRUCTIONS || USE_CPUID_INTRINSICS
# define USE_CPUID 1
#else
# define USE_CPUID 0
......@@ -257,21 +244,6 @@ static bool call_cpuid(int select, int result[4])
}
memcpy(result, tmp, sizeof(tmp));
# elif defined(KWSYS_CXX_HAS_BORLAND_ASM_CPUID)
unsigned int a, b, c, d;
__asm {
mov EAX, select;
cpuid
mov a, EAX;
mov b, EBX;
mov c, ECX;
mov d, EDX;
}
result[0] = a;
result[1] = b;
result[2] = c;
result[3] = d;
# endif
// The cpuid instruction succeeded.
......@@ -297,7 +269,6 @@ using DELAY_FUNC = void (*)(unsigned int);
class SystemInformationImplementation
{
public:
using LongLong = SystemInformation::LongLong;
SystemInformationImplementation();
~SystemInformationImplementation() = default;
......@@ -337,16 +308,16 @@ public:
size_t GetTotalPhysicalMemory() const;
size_t GetAvailablePhysicalMemory() const;
LongLong GetProcessId();
long long GetProcessId();
// Retrieve memory information in KiB.
LongLong GetHostMemoryTotal();
LongLong GetHostMemoryAvailable(const char* hostLimitEnvVarName);
LongLong GetHostMemoryUsed();
long long GetHostMemoryTotal();
long long GetHostMemoryAvailable(const char* hostLimitEnvVarName);
long long GetHostMemoryUsed();
LongLong GetProcMemoryAvailable(const char* hostLimitEnvVarName,
const char* procLimitEnvVarName);
LongLong GetProcMemoryUsed();
long long GetProcMemoryAvailable(const char* hostLimitEnvVarName,
const char* procLimitEnvVarName);
long long GetProcMemoryUsed();
double GetLoadAverage();
......@@ -505,7 +476,8 @@ protected:
void CPUCountWindows(); // For windows
unsigned char GetAPICId(); // For windows
bool IsSMTSupported() const;
static LongLong GetCyclesDifference(DELAY_FUNC, unsigned int); // For windows
static long long GetCyclesDifference(DELAY_FUNC,
unsigned int); // For windows
// For Linux and Cygwin, /proc/cpuinfo formats are slightly different
bool RetreiveInformationFromCpuInfoFile();
......@@ -806,31 +778,31 @@ std::string SystemInformation::GetMemoryDescription(
}
// host memory info in units of KiB.
SystemInformation::LongLong SystemInformation::GetHostMemoryTotal()
long long SystemInformation::GetHostMemoryTotal()
{
return this->Implementation->GetHostMemoryTotal();
}
SystemInformation::LongLong SystemInformation::GetHostMemoryAvailable(
long long SystemInformation::GetHostMemoryAvailable(
const char* hostLimitEnvVarName)
{
return this->Implementation->GetHostMemoryAvailable(hostLimitEnvVarName);
}
SystemInformation::LongLong SystemInformation::GetHostMemoryUsed()
long long SystemInformation::GetHostMemoryUsed()
{
return this->Implementation->GetHostMemoryUsed();
}
// process memory info in units of KiB.
SystemInformation::LongLong SystemInformation::GetProcMemoryAvailable(
long long SystemInformation::GetProcMemoryAvailable(
const char* hostLimitEnvVarName, const char* procLimitEnvVarName)
{
return this->Implementation->GetProcMemoryAvailable(hostLimitEnvVarName,
procLimitEnvVarName);
}
SystemInformation::LongLong SystemInformation::GetProcMemoryUsed()
long long SystemInformation::GetProcMemoryUsed()
{
return this->Implementation->GetProcMemoryUsed();
}
......@@ -840,7 +812,7 @@ double SystemInformation::GetLoadAverage()
return this->Implementation->GetLoadAverage();
}
SystemInformation::LongLong SystemInformation::GetProcessId()
long long SystemInformation::GetProcessId()
{
return this->Implementation->GetProcessId();
}
......@@ -3611,8 +3583,7 @@ bool SystemInformationImplementation::QueryProcessor()
/**
Get total system RAM in units of KiB.
*/
SystemInformation::LongLong
SystemInformationImplementation::GetHostMemoryTotal()
long long SystemInformationImplementation::GetHostMemoryTotal()
{
#if defined(_WIN32)
# if defined(_MSC_VER) && _MSC_VER < 1300
......@@ -3627,7 +3598,7 @@ SystemInformationImplementation::GetHostMemoryTotal()
return statex.ullTotalPhys / 1024;
# endif
#elif defined(__linux)
SystemInformation::LongLong memTotal = 0;
long long memTotal = 0;
int ierr = GetFieldFromFile("/proc/meminfo", "MemTotal:", memTotal);
if (ierr) {
return -1;
......@@ -3650,11 +3621,10 @@ SystemInformationImplementation::GetHostMemoryTotal()
Get total system RAM in units of KiB. This may differ from the
host total if a host-wide resource limit is applied.
*/
SystemInformation::LongLong
SystemInformationImplementation::GetHostMemoryAvailable(
long long SystemInformationImplementation::GetHostMemoryAvailable(
const char* hostLimitEnvVarName)
{
SystemInformation::LongLong memTotal = this->GetHostMemoryTotal();
long long memTotal = this->GetHostMemoryTotal();
// the following mechanism is provided for systems that
// apply resource limits across groups of processes.
......@@ -3665,8 +3635,7 @@ SystemInformationImplementation::GetHostMemoryAvailable(
if (hostLimitEnvVarName) {
const char* hostLimitEnvVarValue = getenv(hostLimitEnvVarName);
if (hostLimitEnvVarValue) {
SystemInformation::LongLong hostLimit =
atoLongLong(hostLimitEnvVarValue);
long long hostLimit = std::atoll(hostLimitEnvVarValue);
if (hostLimit > 0) {
memTotal = min(hostLimit, memTotal);
}
......@@ -3680,20 +3649,17 @@ SystemInformationImplementation::GetHostMemoryAvailable(
Get total system RAM in units of KiB. This may differ from the
host total if a per-process resource limit is applied.
*/
SystemInformation::LongLong
SystemInformationImplementation::GetProcMemoryAvailable(
long long SystemInformationImplementation::GetProcMemoryAvailable(
const char* hostLimitEnvVarName, const char* procLimitEnvVarName)
{
SystemInformation::LongLong memAvail =
this->GetHostMemoryAvailable(hostLimitEnvVarName);
long long memAvail = this->GetHostMemoryAvailable(hostLimitEnvVarName);
// the following mechanism is provide for systems where rlimits
// are not employed. Units are in KiB.
if (procLimitEnvVarName) {
const char* procLimitEnvVarValue = getenv(procLimitEnvVarName);
if (procLimitEnvVarValue) {
SystemInformation::LongLong procLimit =
atoLongLong(procLimitEnvVarValue);
long long procLimit = std::atoll(procLimitEnvVarValue);
if (procLimit > 0) {
memAvail = min(procLimit, memAvail);
}
......@@ -3705,28 +3671,24 @@ SystemInformationImplementation::GetProcMemoryAvailable(
ResourceLimitType rlim;
ierr = GetResourceLimit(RLIMIT_DATA, &rlim);
if ((ierr == 0) && (rlim.rlim_cur != RLIM_INFINITY)) {
memAvail =
min((SystemInformation::LongLong)rlim.rlim_cur / 1024, memAvail);
memAvail = min((long long)rlim.rlim_cur / 1024, memAvail);
}
ierr = GetResourceLimit(RLIMIT_AS, &rlim);
if ((ierr == 0) && (rlim.rlim_cur != RLIM_INFINITY)) {
memAvail =
min((SystemInformation::LongLong)rlim.rlim_cur / 1024, memAvail);
memAvail = min((long long)rlim.rlim_cur / 1024, memAvail);
}
#elif defined(__APPLE__)
struct rlimit rlim;
int ierr;
ierr = getrlimit(RLIMIT_DATA, &rlim);
if ((ierr == 0) && (rlim.rlim_cur != RLIM_INFINITY)) {
memAvail =
min((SystemInformation::LongLong)rlim.rlim_cur / 1024, memAvail);
memAvail = min((long long)rlim.rlim_cur / 1024, memAvail);
}
ierr = getrlimit(RLIMIT_RSS, &rlim);
if ((ierr == 0) && (rlim.rlim_cur != RLIM_INFINITY)) {
memAvail =
min((SystemInformation::LongLong)rlim.rlim_cur / 1024, memAvail);
memAvail = min((long long)rlim.rlim_cur / 1024, memAvail);
}
#endif
......@@ -3736,8 +3698,7 @@ SystemInformationImplementation::GetProcMemoryAvailable(
/**
Get RAM used by all processes in the host, in units of KiB.
*/
SystemInformation::LongLong
SystemInformationImplementation::GetHostMemoryUsed()
long long SystemInformationImplementation::GetHostMemoryUsed()
{
#if defined(_WIN32)
# if defined(_MSC_VER) && _MSC_VER < 1300
......@@ -3754,39 +3715,38 @@ SystemInformationImplementation::GetHostMemoryUsed()
#elif defined(__linux)
// First try to use MemAvailable, but it only works on newer kernels
const char* names2[3] = { "MemTotal:", "MemAvailable:", nullptr };
SystemInformation::LongLong values2[2] = { SystemInformation::LongLong(0) };
long long values2[2] = { 0 };
int ierr = GetFieldsFromFile("/proc/meminfo", names2, values2);
if (ierr) {
const char* names4[5] = { "MemTotal:", "MemFree:", "Buffers:", "Cached:",
nullptr };
SystemInformation::LongLong values4[4] = { SystemInformation::LongLong(
0) };
long long values4[4] = { 0 };
ierr = GetFieldsFromFile("/proc/meminfo", names4, values4);
if (ierr) {
return ierr;
}
SystemInformation::LongLong& memTotal = values4[0];
SystemInformation::LongLong& memFree = values4[1];
SystemInformation::LongLong& memBuffers = values4[2];
SystemInformation::LongLong& memCached = values4[3];
long long& memTotal = values4[0];
long long& memFree = values4[1];
long long& memBuffers = values4[2];
long long& memCached = values4[3];
return memTotal - memFree - memBuffers - memCached;
}
SystemInformation::LongLong& memTotal = values2[0];
SystemInformation::LongLong& memAvail = values2[1];
long long& memTotal = values2[0];
long long& memAvail = values2[1];
return memTotal - memAvail;
#elif defined(__APPLE__)
SystemInformation::LongLong psz = getpagesize();
long long psz = getpagesize();
if (psz < 1) {
return -1;
}
const char* names[3] = { "Pages wired down:", "Pages active:", nullptr };
SystemInformation::LongLong values[2] = { SystemInformation::LongLong(0) };
long long values[2] = { 0 };
int ierr = GetFieldsFromCommand("vm_stat", names, values);
if (ierr) {
return -1;
}
SystemInformation::LongLong& vmWired = values[0];
SystemInformation::LongLong& vmActive = values[1];
long long& vmWired = values[0];
long long& vmActive = values[1];
return ((vmActive + vmWired) * psz) / 1024;
#else
return 0;
......@@ -3797,8 +3757,7 @@ SystemInformationImplementation::GetHostMemoryUsed()
Get system RAM used by the process associated with the given
process id in units of KiB.
*/
SystemInformation::LongLong
SystemInformationImplementation::GetProcMemoryUsed()
long long SystemInformationImplementation::GetProcMemoryUsed()
{
#if defined(_WIN32) && defined(KWSYS_SYS_HAS_PSAPI)
long pid = GetCurrentProcessId();
......@@ -3815,14 +3774,14 @@ SystemInformationImplementation::GetProcMemoryUsed()
}
return pmc.WorkingSetSize / 1024;
#elif defined(__linux)
SystemInformation::LongLong memUsed = 0;
long long memUsed = 0;
int ierr = GetFieldFromFile("/proc/self/status", "VmRSS:", memUsed);
if (ierr) {
return -1;
}
return memUsed;
#elif defined(__APPLE__)
SystemInformation::LongLong memUsed = 0;
long long memUsed = 0;
pid_t pid = getpid();
std::ostringstream oss;
oss << "ps -o rss= -p " << pid;
......@@ -3886,7 +3845,7 @@ double SystemInformationImplementation::GetLoadAverage()
/**
Get the process id of the running process.
*/
SystemInformation::LongLong SystemInformationImplementation::GetProcessId()
long long SystemInformationImplementation::GetProcessId()
{
#if defined(_WIN32)
return GetCurrentProcessId();