aboutsummaryrefslogtreecommitdiffstats
path: root/util/system/info.cpp
diff options
context:
space:
mode:
authorakhropov <akhropov@yandex-team.ru>2022-02-10 16:46:32 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:46:32 +0300
commit298c6da79f1d8f35089a67f463f0b541bec36d9b (patch)
tree1a2c5ffcf89eb53ecd79dbc9bc0a195c27404d0c /util/system/info.cpp
parent00afc96e9c0298054b7386fa7fb9e3cc3d67b974 (diff)
downloadydb-298c6da79f1d8f35089a67f463f0b541bec36d9b.tar.gz
Restoring authorship annotation for <akhropov@yandex-team.ru>. Commit 2 of 2.
Diffstat (limited to 'util/system/info.cpp')
-rw-r--r--util/system/info.cpp44
1 files changed, 22 insertions, 22 deletions
diff --git a/util/system/info.cpp b/util/system/info.cpp
index dacad12282..cf6681e89a 100644
--- a/util/system/info.cpp
+++ b/util/system/info.cpp
@@ -1,7 +1,7 @@
#include "info.h"
-#include "error.h"
-
+#include "error.h"
+
#include <cstdlib>
#if defined(_linux_) || defined(_cygwin_)
@@ -26,7 +26,7 @@ static int getloadavg(double* loadavg, int nelem) {
return nelem;
}
-#elif defined(_unix_) || defined(_darwin_)
+#elif defined(_unix_) || defined(_darwin_)
#include <sys/types.h>
#endif
@@ -38,7 +38,7 @@ static int getloadavg(double* loadavg, int nelem) {
#include <util/string/cast.h>
#include <util/string/strip.h>
#include <util/stream/file.h>
-#include <util/generic/yexception.h>
+#include <util/generic/yexception.h>
#if defined(_linux_)
static inline size_t CgroupCpus() {
@@ -204,25 +204,25 @@ size_t NSystemInfo::TotalMemorySize() {
sysinfo(&info);
return info.totalram;
#elif defined(_darwin_)
- int mib[2];
- int64_t memSize;
- size_t length;
-
- // Get the Physical memory size
- mib[0] = CTL_HW;
- mib[1] = HW_MEMSIZE;
- length = sizeof(int64_t);
- if (sysctl(mib, 2, &memSize, &length, NULL, 0) != 0) {
- ythrow yexception() << "sysctl failed: " << LastSystemErrorText();
- }
- return (size_t)memSize;
+ int mib[2];
+ int64_t memSize;
+ size_t length;
+
+ // Get the Physical memory size
+ mib[0] = CTL_HW;
+ mib[1] = HW_MEMSIZE;
+ length = sizeof(int64_t);
+ if (sysctl(mib, 2, &memSize, &length, NULL, 0) != 0) {
+ ythrow yexception() << "sysctl failed: " << LastSystemErrorText();
+ }
+ return (size_t)memSize;
#elif defined(_win_)
- MEMORYSTATUSEX memoryStatusEx;
- memoryStatusEx.dwLength = sizeof(memoryStatusEx);
- if (!GlobalMemoryStatusEx(&memoryStatusEx)) {
- ythrow yexception() << "GlobalMemoryStatusEx failed: " << LastSystemErrorText();
- }
- return (size_t)memoryStatusEx.ullTotalPhys;
+ MEMORYSTATUSEX memoryStatusEx;
+ memoryStatusEx.dwLength = sizeof(memoryStatusEx);
+ if (!GlobalMemoryStatusEx(&memoryStatusEx)) {
+ ythrow yexception() << "GlobalMemoryStatusEx failed: " << LastSystemErrorText();
+ }
+ return (size_t)memoryStatusEx.ullTotalPhys;
#else
return 0;
#endif