Adjusted DbBindableLong to be 64 bits if needed and adjusted timing for 64 bits

This commit is contained in:
Cekis
2021-12-21 18:22:16 -05:00
parent 66fc6c48dd
commit 4d7c0de43f
6 changed files with 60 additions and 40 deletions
+20 -17
View File
@@ -66,24 +66,21 @@ if (WIN32)
elseif (UNIX)
find_package(Curses REQUIRED)
# linker flags
if (${CMAKE_BUILD_TYPE} STREQUAL "RELWITHDEBINFO" OR ${CMAKE_BUILD_TYPE} STREQUAL "MINSIZEREL")
set(CMAKE_SHARED_LINKER_FLAGS "-Wl,-z,norelro,-O3,--sort-common,--as-needed,--relax,-z,combreloc,-z,global,--no-omagic")
set(CMAKE_EXE_LINKER_FLAGS "-Wl,-z,norelro,-O3,--sort-common,--as-needed,--relax,-z,combreloc,-z,global,--no-omagic")
else ()
set(CMAKE_SHARED_LINKER_FLAGS "-Wl,-z,norelro,-O3,--sort-common,--as-needed,--relax,-z,combreloc,-z,global,--no-omagic,-x,-s")
set(CMAKE_EXE_LINKER_FLAGS "-Wl,-z,norelro,-O3,--sort-common,--as-needed,--relax,-z,combreloc,-z,global,--no-omagic,-x,-s")
# Global Linker flags
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,-z,norelro,-O3,--sort-common,--as-needed,--relax,-z,combreloc,-z,global,--no-omagic")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,-z,norelro,-O3,--sort-common,--as-needed,--relax,-z,combreloc,-z,global,--no-omagic")
# Strip debug symbols if RELEASE or MINSIZEREL
if (${CMAKE_BUILD_TYPE} STREQUAL "RELEASE" OR ${CMAKE_BUILD_TYPE} STREQUAL "MINSIZEREL")
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS},-x,-s")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS},-x,-s")
endif ()
# don't put anything too crazy in debug...and any common flags go into CMAKE_CXX_FLAGS
set(CMAKE_CXX_FLAGS_DEBUG "-D_DEBUG -DDEBUG_LEVEL=2 -DPRODUCTION=0 -O0 -ggdb -pg")
# release specific cflags - optimizations beyond the default for both types is mostly just -O flags
set(CMAKE_CXX_FLAGS_RELEASE "-DDEBUG_LEVEL=0 -DPRODUCTION=1")
# we use fewer, if any, crazy optimizations for profile generation, and likewise release flags for the minsizerel
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -D_DEBUG -DDEBUG_LEVEL=2 -DPRODUCTION=0 -pg")
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -DDEBUG_LEVEL=0 -DPRODUCTION=1")
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELEASE} -ggdb -pg")
set(CMAKE_CXX_FLAGS_MINSIZEREL "${CMAKE_CXX_FLAGS_RELEASE}")
set(CMAKE_CXX_FLAGS_MINSIZEREL "${CMAKE_CXX_FLAGS_MINSIZEREL}")
# our "always on" flags - build by default for the system we're on but include all instruction sets
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pipe -march=native -mtune=native \
@@ -101,7 +98,7 @@ elseif (UNIX)
-fno-coverage-mapping -fno-spell-checking \
-mno-retpoline")
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -ggdb -fprofile-instr-generate -fcoverage-mapping")
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -O0 -g -fprofile-instr-generate -fcoverage-mapping")
# RELWITHDEBINFO is used for building bins that produce profdata files
# we only need the basics of our heavy optimizations here, i think - that and one of these flags
@@ -113,7 +110,7 @@ elseif (UNIX)
elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
# O3 and Ofast include one or more flags that cause java to crash when using gcc6
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -O2 -fno-signed-zeros -freciprocal-math -fno-unroll-loops -fno-tree-loop-optimize -fno-plt")
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -Og -no-pie")
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -Og -ggdb -no-pie")
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} -no-pie")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-stringop-overflow")
elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Intel")
@@ -123,11 +120,17 @@ elseif (UNIX)
add_definitions(-DLINUX -D_REENTRANT -Dlinux -D_USING_STL -D_GNU_SOURCE -D_XOPEN_SOURCE=500 -U_FORTIFY_SOURCE)
# this is so some profile specific stuff is turned on in the code
if (${CMAKE_BUILD_TYPE} STREQUAL "RELWITHDEBINFO")
if (${CMAKE_BUILD_TYPE} STREQUAL "RELWITHDEBINFO" OR ${CMAKE_BUILD_TYPE} STREQUAL "DEBUG")
add_definitions(-DENABLE_PROFILING)
endif ()
endif ()
message("Flags CXX: ${CMAKE_CXX_FLAGS}")
message("Flags DEBUG: ${CMAKE_CXX_FLAGS_DEBUG}")
message("Flags RELWITHDEBINFO: ${CMAKE_CXX_FLAGS_RELWITHDEBINFO}")
message("Flags RELEASE: ${CMAKE_CXX_FLAGS_RELEASE}")
message("Flags MINSIZEREL: ${CMAKE_CXX_FLAGS_MINSIZEREL}")
add_subdirectory(external)
add_subdirectory(engine)
add_subdirectory(game)
@@ -122,8 +122,8 @@ void ManagerConnection::onReceive(const Archive::ByteStream & message)
}
case constcrc("TaskConnectionIdMessage") :
{
static long const clockDriftFatalTimePeriod = static_cast<long>(TaskManager::getStartTime()) + ConfigTaskManager::getClockDriftFatalIntervalSeconds();
long const currentTime = static_cast<long>(::time(nullptr));
static uint32_t const clockDriftFatalTimePeriod = static_cast<uint32_t>(TaskManager::getStartTime()) + ConfigTaskManager::getClockDriftFatalIntervalSeconds();
uint32_t const currentTime = static_cast<uint32_t>(::time(nullptr));
TaskConnectionIdMessage t(r);
WARNING_STRICT_FATAL(t.getServerType() != TaskConnectionIdMessage::TaskManager,
("ManagerConnection received wrong type identifier"));
@@ -34,7 +34,7 @@ public:
const unsigned char getServerType () const;
const std::string & getCommandLine () const;
const std::string & getClusterName () const;
const long getCurrentEpochTime() const;
const uint32_t getCurrentEpochTime() const;
private:
TaskConnectionIdMessage & operator = (const TaskConnectionIdMessage & rhs);
TaskConnectionIdMessage(const TaskConnectionIdMessage & source);
@@ -42,7 +42,7 @@ private:
Archive::AutoVariable<unsigned char> serverType;
Archive::AutoVariable<std::string> commandLine;
Archive::AutoVariable<std::string> clusterName;
Archive::AutoVariable<uint32_t> currentEpochTime;
Archive::AutoVariable<uint32_t> currentEpochTime;
};
//-----------------------------------------------------------------------
@@ -68,7 +68,7 @@ inline const unsigned char TaskConnectionIdMessage::getServerType() const
//-----------------------------------------------------------------------
inline const long TaskConnectionIdMessage::getCurrentEpochTime() const
inline const uint32_t TaskConnectionIdMessage::getCurrentEpochTime() const
{
return currentEpochTime.get();
}
@@ -18,7 +18,7 @@ BindableLong::BindableLong() : Bindable(), value(-999)
{
}
BindableLong::BindableLong(int32_t _value) : Bindable(sizeof(value)), value(_value)
BindableLong::BindableLong(int64_t _value) : Bindable(sizeof(value)), value(_value)
{
}
@@ -29,14 +29,15 @@ void *BindableLong::getBuffer()
// ----------------------------------------------------------------------
int32_t BindableLong::getValue() const
int64_t BindableLong::getValue() const
{
return value;
}
// ----------------------------------------------------------------------
BindableLong &BindableLong::operator=(int32_t rhs)
BindableLong &BindableLong::operator=(int64_t rhs)
{
indicator=sizeof(value);
value=rhs;
@@ -45,7 +46,7 @@ BindableLong &BindableLong::operator=(int32_t rhs)
// ----------------------------------------------------------------------
void BindableLong::setValue(int32_t rhs)
void BindableLong::setValue(int64_t rhs)
{
indicator=sizeof(value);
value=rhs;
@@ -23,43 +23,45 @@ namespace DB {
{
public:
BindableLong();
explicit BindableLong(int32_t _value);
explicit BindableLong(int64_t _value);
int32_t getValue() const;
void setValue(const int32_t rhs);
BindableLong &operator=(const int32_t rhs);
int64_t getValue() const;
void setValue(const int64_t rhs);
BindableLong &operator=(const int64_t rhs);
// following alternate getValue's are provided for convenience, particularly in
// the auto-generated code:
void getValue(int8 &buffer) const;
void getValue(uint8 &buffer) const;
void getValue(int8_t &buffer) const;
void getValue(uint8_t &buffer) const;
void getValue(int16_t &buffer) const;
void getValue(uint16_t &buffer) const;
void getValue(int32_t &buffer) const;
void getValue(uint32_t &buffer) const;
void getValue(int64_t &buffer) const;
void getValue(uint64_t &buffer) const;
void *getBuffer();
virtual std::string outputValue() const;
private:
int32_t value;
int64_t value;
}; //lint !e1721 !e1509 // no virtual destructor, unusual operator =
}
// ----------------------------------------------------------------------
inline void DB::BindableLong::getValue(int8 &buffer) const
inline void DB::BindableLong::getValue(int8_t &buffer) const
{
buffer=static_cast<int8>(getValue());
buffer=static_cast<int8_t>(getValue());
}
// ----------------------------------------------------------------------
inline void DB::BindableLong::getValue(uint8 &buffer) const
inline void DB::BindableLong::getValue(uint8_t &buffer) const
{
buffer=static_cast<uint8>(getValue());
buffer=static_cast<uint8_t>(getValue());
}
// ----------------------------------------------------------------------
@@ -84,9 +86,23 @@ inline void DB::BindableLong::getValue(int32_t &buffer) const
// ----------------------------------------------------------------------
inline void DB::BindableLong::getValue(uint32 &buffer) const
inline void DB::BindableLong::getValue(uint32_t &buffer) const
{
buffer=static_cast<uint32>(getValue());
buffer=static_cast<uint32_t>(getValue());
}
// ----------------------------------------------------------------------
inline void DB::BindableLong::getValue(int64_t &buffer) const
{
buffer=getValue();
}
// ----------------------------------------------------------------------
inline void DB::BindableLong::getValue(uint64_t &buffer) const
{
buffer=static_cast<uint64_t>(getValue());
}
@@ -111,7 +111,7 @@ namespace AlterSchedulerNamespace
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
float const cs_schedulerTicksPerSecond = 1000.0f; // # schedule ticks per second. Frame rates will not be able to exceed this.
float const cs_schedulerTicksPerSecond = 2000.0f; // # schedule ticks per second. Frame rates will not be able to exceed this.
float const cs_secondsPerSchedulerTick = 1.0f / cs_schedulerTicksPerSecond;
uint64_t const cs_freeFillPattern = 0xEFEFEFEFEFEFEFEF; // this should match MemoryManager's free fill pattern.