Move getPageSize in common

This commit is contained in:
Maksim Kita 2020-12-17 00:23:41 +03:00
parent 80dbbc7e58
commit 685099af7f
16 changed files with 23 additions and 18 deletions

View File

@ -6,6 +6,7 @@ set (SRCS
demangle.cpp
getFQDNOrHostName.cpp
getMemoryAmount.cpp
getPageSize.cpp
getThreadId.cpp
JSON.cpp
LineReader.cpp

View File

@ -1,5 +1,6 @@
#include <stdexcept>
#include "common/getMemoryAmount.h"
#include "common/getPageSize.h"
#include <unistd.h>
#include <sys/types.h>
@ -18,7 +19,7 @@ uint64_t getMemoryAmountOrZero()
if (num_pages <= 0)
return 0;
int64_t page_size = sysconf(_SC_PAGESIZE);
int64_t page_size = getPageSize();
if (page_size <= 0)
return 0;

View File

@ -1,8 +1,8 @@
#include "getPageSize.h"
#include "common/getPageSize.h"
#include <unistd.h>
long getPageSize()
Int64 getPageSize()
{
return sysconf(_SC_PAGESIZE);
}

View File

@ -0,0 +1,6 @@
#pragma once
#include "common/types.h"
/// Get memory page size
Int64 getPageSize();

View File

@ -44,6 +44,7 @@ SRCS(
argsToConfig.cpp
coverage.cpp
demangle.cpp
getPageSize.cpp
errnoToString.cpp
getFQDNOrHostName.cpp
getMemoryAmount.cpp

View File

@ -26,11 +26,11 @@
#define DISABLE_MREMAP 1
#endif
#include <common/mremap.h>
#include <common/getPageSize.h>
#include <Common/MemoryTracker.h>
#include <Common/Exception.h>
#include <Common/formatReadable.h>
#include <Common/getPageSize.h>
#include <Common/Allocator_fwd.h>

View File

@ -13,10 +13,11 @@
#include <boost/noncopyable.hpp>
#include <ext/scope_guard.h>
#include <common/getPageSize.h>
#include <Common/Exception.h>
#include <Common/randomSeed.h>
#include <Common/formatReadable.h>
#include <Common/getPageSize.h>
/// Required for older Darwin builds, that lack definition of MAP_ANONYMOUS
#ifndef MAP_ANONYMOUS

View File

@ -8,11 +8,11 @@
#include "MemoryStatisticsOS.h"
#include <common/logger_useful.h>
#include <common/getPageSize.h>
#include <Common/Exception.h>
#include <Common/getPageSize.h>
#include <IO/ReadBufferFromMemory.h>
#include <IO/ReadHelpers.h>
#include <common/logger_useful.h>
namespace DB

View File

@ -1,9 +1,9 @@
#pragma once
#include <common/getPageSize.h>
#include <Common/Exception.h>
#include <Common/StringUtils/StringUtils.h>
#include <Common/UTF8Helpers.h>
#include <Common/getPageSize.h>
#include <Core/Defines.h>
#include <ext/range.h>
#include <Poco/Unicode.h>

View File

@ -1,4 +0,0 @@
#pragma once
/// Get memory page size
long getPageSize();

View File

@ -99,7 +99,6 @@ SRCS(
getMappedArea.cpp
getMultipleKeysFromConfig.cpp
getNumberOfPhysicalCPUCores.cpp
getPageSize.cpp
hasLinuxCapability.cpp
hex.cpp
isLocalAddress.cpp

View File

@ -6,7 +6,7 @@
#include <Common/ProfileEvents.h>
#include <Common/formatReadable.h>
#include <Common/Exception.h>
#include <Common/getPageSize.h>
#include <common/getPageSize.h>
#include <IO/WriteHelpers.h>
#include <IO/MMapReadBufferFromFileDescriptor.h>

View File

@ -3,7 +3,7 @@
#include <iostream>
#include <common/types.h>
#include <Common/getPageSize.h>
#include <common/getPageSize.h>
#include <IO/WriteHelpers.h>
#include <IO/ReadHelpers.h>
#include <IO/WriteBufferFromFile.h>

View File

@ -5,7 +5,7 @@
#include <Common/TaskStatsInfoGetter.h>
#include <Poco/File.h>
#include <Common/Stopwatch.h>
#include <Common/getPageSize.h>
#include <common/getPageSize.h>
#include <common/getThreadId.h>
#include <IO/WriteBufferFromString.h>
#include <linux/taskstats.h>

View File

@ -6,7 +6,7 @@
#include <Common/Stopwatch.h>
#include <Common/ThreadPool.h>
#include <Common/randomSeed.h>
#include <Common/getPageSize.h>
#include <common/getPageSize.h>
#include <cstdlib>
#include <iomanip>

View File

@ -14,7 +14,7 @@ int main(int, char **) { return 0; }
#include <Common/ThreadPool.h>
#include <Common/Stopwatch.h>
#include <Common/randomSeed.h>
#include <Common/getPageSize.h>
#include <common/getPageSize.h>
#include <pcg_random.hpp>
#include <IO/BufferWithOwnMemory.h>
#include <IO/ReadHelpers.h>