summaryrefslogtreecommitdiff
path: root/databases/clickhouse/files/patch-src_Common_MemoryStatisticsOS.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'databases/clickhouse/files/patch-src_Common_MemoryStatisticsOS.cpp')
-rw-r--r--databases/clickhouse/files/patch-src_Common_MemoryStatisticsOS.cpp38
1 files changed, 17 insertions, 21 deletions
diff --git a/databases/clickhouse/files/patch-src_Common_MemoryStatisticsOS.cpp b/databases/clickhouse/files/patch-src_Common_MemoryStatisticsOS.cpp
index a4e9ad63dbcc..de0458181f69 100644
--- a/databases/clickhouse/files/patch-src_Common_MemoryStatisticsOS.cpp
+++ b/databases/clickhouse/files/patch-src_Common_MemoryStatisticsOS.cpp
@@ -1,6 +1,6 @@
---- src/Common/MemoryStatisticsOS.cpp.orig 2020-08-31 16:22:57 UTC
+--- src/Common/MemoryStatisticsOS.cpp.orig 2021-03-19 11:39:14 UTC
+++ src/Common/MemoryStatisticsOS.cpp
-@@ -1,7 +1,13 @@
+@@ -1,14 +1,20 @@
-#if defined(OS_LINUX)
-
#include <sys/types.h>
@@ -16,19 +16,15 @@
#include <fcntl.h>
#include <unistd.h>
#include <cassert>
-@@ -11,9 +17,10 @@
- #include <Common/Exception.h>
- #include <IO/ReadBufferFromMemory.h>
- #include <IO/ReadHelpers.h>
--#include <common/logger_useful.h>
+ #include "MemoryStatisticsOS.h"
-+
-+
- namespace DB
- {
-
-@@ -23,21 +30,40 @@ namespace ErrorCodes
+-#include <common/logger_useful.h>
++//#include <common/logger_useful.h>
+ #include <common/getPageSize.h>
+ #include <Common/Exception.h>
+ #include <IO/ReadBufferFromMemory.h>
+@@ -24,20 +30,40 @@ namespace ErrorCodes
extern const int CANNOT_OPEN_FILE;
extern const int CANNOT_READ_FROM_FILE_DESCRIPTOR;
extern const int CANNOT_CLOSE_FILE;
@@ -37,9 +33,10 @@
+#endif
}
+-static constexpr auto filename = "/proc/self/statm";
+#ifndef OS_FREEBSD
- static constexpr auto filename = "/proc/self/statm";
- static constexpr size_t PAGE_SIZE = 4096;
++ static constexpr auto filename = "/proc/self/statm";
++ static constexpr size_t PAGE_SIZE = 4096;
+#endif
MemoryStatisticsOS::MemoryStatisticsOS()
@@ -69,7 +66,7 @@
if (0 != ::close(fd))
{
try
-@@ -51,12 +77,43 @@ MemoryStatisticsOS::~MemoryStatisticsOS()
+@@ -51,12 +77,42 @@ MemoryStatisticsOS::~MemoryStatisticsOS()
DB::tryLogCurrentException(__PRETTY_FUNCTION__);
}
}
@@ -109,14 +106,13 @@
+ ::procstat_freevmmap(pstat, kve);
+ ::procstat_freeprocs(pstat, kp);
+#else
-+
constexpr size_t buf_size = 1024;
char buf[buf_size];
-@@ -98,10 +155,8 @@ MemoryStatisticsOS::Data MemoryStatisticsOS::get() con
- data.shared *= PAGE_SIZE;
- data.code *= PAGE_SIZE;
- data.data_and_stack *= PAGE_SIZE;
+@@ -99,10 +155,8 @@ MemoryStatisticsOS::Data MemoryStatisticsOS::get() con
+ data.shared *= page_size;
+ data.code *= page_size;
+ data.data_and_stack *= page_size;
-
+#endif
return data;