Compare commits

...

5 Commits

Author SHA1 Message Date
tqcq
4048a07229 feat only static gcc
Some checks failed
android / build (push) Failing after 3m19s
linux-aarch64-cpu-gcc / linux-gcc-aarch64 (Debug) (push) Failing after 10m20s
linux-aarch64-cpu-gcc / linux-gcc-aarch64 (Release) (push) Failing after 12m42s
linux-arm-gcc / linux-gcc-arm (Debug) (push) Failing after 7m30s
linux-arm-gcc / linux-gcc-arm (Release) (push) Failing after 8m37s
linux-arm-gcc / linux-gcc-armhf (Debug) (push) Failing after 8m7s
linux-mips-gcc / linux-gcc-mipsel (Debug) (push) Failing after 9m3s
linux-arm-gcc / linux-gcc-armhf (Release) (push) Failing after 12m18s
linux-mips-gcc / linux-gcc-mipsel (Release) (push) Failing after 9m33s
linux-mips64-gcc / linux-gcc-mips64el (Debug) (push) Failing after 8m58s
linux-mips64-gcc / linux-gcc-mips64el (Release) (push) Failing after 9m29s
linux-riscv64-gcc / linux-gcc-riscv64 (Debug) (push) Failing after 10m7s
linux-riscv64-gcc / linux-gcc-riscv64 (Release) (push) Failing after 8m27s
linux-x64-clang / linux-clang (Debug) (push) Failing after 1m39s
linux-x64-clang / linux-clang (Release) (push) Failing after 1m32s
linux-x64-gcc / linux-gcc (Debug) (push) Failing after 9m30s
linux-x64-gcc / linux-gcc (Release) (push) Failing after 3h8m39s
linux-x86-gcc / linux-gcc (Debug) (push) Failing after 8m39s
linux-x86-gcc / linux-gcc (Release) (push) Failing after 1h12m49s
2024-10-15 15:57:48 +08:00
tqcq
90bb082ef9 fix: remove static-libgcc
Some checks failed
android / build (push) Failing after 21s
linux-aarch64-cpu-gcc / linux-gcc-aarch64 (Debug) (push) Failing after 7m2s
linux-aarch64-cpu-gcc / linux-gcc-aarch64 (Release) (push) Failing after 17m11s
linux-arm-gcc / linux-gcc-arm (Debug) (push) Failing after 1m18s
linux-arm-gcc / linux-gcc-arm (Release) (push) Failing after 1m20s
linux-arm-gcc / linux-gcc-armhf (Debug) (push) Failing after 13m18s
linux-mips-gcc / linux-gcc-mipsel (Release) (push) Failing after 3m11s
linux-arm-gcc / linux-gcc-armhf (Release) (push) Failing after 13m37s
linux-mips-gcc / linux-gcc-mipsel (Debug) (push) Failing after 13m36s
linux-mips64-gcc / linux-gcc-mips64el (Debug) (push) Failing after 15m22s
linux-mips64-gcc / linux-gcc-mips64el (Release) (push) Failing after 19m48s
linux-riscv64-gcc / linux-gcc-riscv64 (Debug) (push) Failing after 18m32s
linux-riscv64-gcc / linux-gcc-riscv64 (Release) (push) Failing after 19m32s
linux-x64-clang / linux-clang (Debug) (push) Failing after 1m3s
linux-x64-clang / linux-clang (Release) (push) Failing after 1m18s
linux-x64-gcc / linux-gcc (Debug) (push) Failing after 1m24s
linux-x64-gcc / linux-gcc (Release) (push) Failing after 1m16s
linux-x86-gcc / linux-gcc (Debug) (push) Failing after 13m50s
linux-x86-gcc / linux-gcc (Release) (push) Failing after 3h14m54s
2024-10-15 14:52:44 +08:00
tqcq
68c3f526fd fix: message
Some checks failed
linux-arm-gcc / linux-gcc-armhf (Release) (push) Waiting to run
linux-mips-gcc / linux-gcc-mipsel (Debug) (push) Waiting to run
linux-mips-gcc / linux-gcc-mipsel (Release) (push) Waiting to run
linux-mips64-gcc / linux-gcc-mips64el (Debug) (push) Waiting to run
linux-mips64-gcc / linux-gcc-mips64el (Release) (push) Waiting to run
linux-riscv64-gcc / linux-gcc-riscv64 (Debug) (push) Waiting to run
linux-riscv64-gcc / linux-gcc-riscv64 (Release) (push) Waiting to run
linux-x64-clang / linux-clang (Debug) (push) Waiting to run
linux-x64-clang / linux-clang (Release) (push) Waiting to run
linux-x64-gcc / linux-gcc (Debug) (push) Waiting to run
linux-x64-gcc / linux-gcc (Release) (push) Waiting to run
linux-x86-gcc / linux-gcc (Debug) (push) Waiting to run
linux-x86-gcc / linux-gcc (Release) (push) Waiting to run
android / build (push) Failing after 43s
linux-aarch64-cpu-gcc / linux-gcc-aarch64 (Debug) (push) Failing after 6m37s
linux-aarch64-cpu-gcc / linux-gcc-aarch64 (Release) (push) Failing after 7m58s
linux-arm-gcc / linux-gcc-arm (Debug) (push) Failing after 6m57s
linux-arm-gcc / linux-gcc-arm (Release) (push) Failing after 7m32s
linux-arm-gcc / linux-gcc-armhf (Debug) (push) Has been cancelled
2024-10-15 14:15:38 +08:00
tqcq
c755acfe14 feat: static use object
Some checks failed
android / build (push) Failing after 1m57s
linux-aarch64-cpu-gcc / linux-gcc-aarch64 (Debug) (push) Failing after 1m17s
linux-aarch64-cpu-gcc / linux-gcc-aarch64 (Release) (push) Failing after 13m38s
linux-arm-gcc / linux-gcc-arm (Debug) (push) Failing after 36s
linux-arm-gcc / linux-gcc-arm (Release) (push) Failing after 1m28s
linux-arm-gcc / linux-gcc-armhf (Debug) (push) Failing after 1m33s
linux-arm-gcc / linux-gcc-armhf (Release) (push) Failing after 1m19s
linux-mips-gcc / linux-gcc-mipsel (Debug) (push) Failing after 13m40s
linux-mips64-gcc / linux-gcc-mips64el (Release) (push) Failing after 1m35s
linux-riscv64-gcc / linux-gcc-riscv64 (Debug) (push) Failing after 1m17s
linux-riscv64-gcc / linux-gcc-riscv64 (Release) (push) Failing after 1m39s
linux-mips-gcc / linux-gcc-mipsel (Release) (push) Failing after 14m33s
linux-mips64-gcc / linux-gcc-mips64el (Debug) (push) Failing after 14m24s
linux-x64-clang / linux-clang (Debug) (push) Failing after 14m46s
linux-x64-clang / linux-clang (Release) (push) Failing after 30s
linux-x64-gcc / linux-gcc (Debug) (push) Failing after 29s
linux-x64-gcc / linux-gcc (Release) (push) Failing after 2m16s
linux-x86-gcc / linux-gcc (Debug) (push) Failing after 35s
linux-x86-gcc / linux-gcc (Release) (push) Failing after 11m4s
2024-10-15 11:34:57 +08:00
tqcq
3c9e2260c8 feat: chrono update duration=1ms
Some checks failed
linux-mips-gcc / linux-gcc-mipsel (Debug) (push) Waiting to run
linux-mips-gcc / linux-gcc-mipsel (Release) (push) Waiting to run
linux-mips64-gcc / linux-gcc-mips64el (Debug) (push) Waiting to run
linux-mips64-gcc / linux-gcc-mips64el (Release) (push) Waiting to run
linux-riscv64-gcc / linux-gcc-riscv64 (Debug) (push) Waiting to run
linux-riscv64-gcc / linux-gcc-riscv64 (Release) (push) Waiting to run
linux-x64-clang / linux-clang (Debug) (push) Waiting to run
linux-x64-clang / linux-clang (Release) (push) Waiting to run
linux-x64-gcc / linux-gcc (Debug) (push) Waiting to run
linux-x64-gcc / linux-gcc (Release) (push) Waiting to run
linux-x86-gcc / linux-gcc (Debug) (push) Waiting to run
linux-x86-gcc / linux-gcc (Release) (push) Waiting to run
android / build (push) Failing after 24s
linux-aarch64-cpu-gcc / linux-gcc-aarch64 (Debug) (push) Failing after 1m16s
linux-aarch64-cpu-gcc / linux-gcc-aarch64 (Release) (push) Failing after 1m18s
linux-arm-gcc / linux-gcc-arm (Debug) (push) Failing after 1m26s
linux-arm-gcc / linux-gcc-arm (Release) (push) Failing after 10m33s
linux-arm-gcc / linux-gcc-armhf (Debug) (push) Failing after 16m32s
linux-arm-gcc / linux-gcc-armhf (Release) (push) Has been cancelled
2024-10-15 10:59:42 +08:00
4 changed files with 24 additions and 15 deletions

View File

@ -20,17 +20,17 @@ set(CMAKE_CXX_EXTENSIONS OFF)
set(CMAKE_POSITION_INDEPENDENT_CODE ON) set(CMAKE_POSITION_INDEPENDENT_CODE ON)
# add static libgcc and libstdc++ for static linking # add static libgcc and libstdc++ for static linking
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -static-libgcc -static-libstdc++") set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -static-libgcc")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -static-libgcc -static-libstdc++") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -static-libgcc")
option(TILE_BUILD_TESTS "Build tests" OFF) option(TILE_BUILD_TESTS "Build tests" ON)
option(TILE_BUILD_BENCHMARKS "Build tests" OFF) option(TILE_BUILD_BENCHMARKS "Build tests" ON)
option(TILE_WITH_OPENSSL "Build with openssl" OFF) option(TILE_WITH_OPENSSL "Build with openssl" OFF)
option(TILE_BUILD_SHARED "Build shared library" ON) option(TILE_BUILD_SHARED "Build shared library" ON)
if(CMAKE_CURRENT_SOURCE_DIR STREQUAL CMAKE_SOURCE_DIR) if(NOT CMAKE_CURRENT_SOURCE_DIR STREQUAL CMAKE_SOURCE_DIR)
set(TILE_BUILD_TESTS ON) set(TILE_BUILD_TESTS OFF)
set(TILE_BUILD_BENCHMARKS ON) set(TILE_BUILD_BENCHMARKS OFF)
endif() endif()
if(NOT CMAKE_BUILD_TYPE) if(NOT CMAKE_BUILD_TYPE)
@ -227,8 +227,10 @@ endif()
if (TILE_BUILD_SHARED) if (TILE_BUILD_SHARED)
add_library(tile SHARED ${TILE_SRCS}) add_library(tile SHARED ${TILE_SRCS})
message(STATUS "Build tile shared library")
else() else()
add_library(tile STATIC ${TILE_SRCS}) add_library(tile OBJECT ${TILE_SRCS})
message(STATUS "Build tile object library")
endif() endif()
set_target_properties(tile PROPERTIES VERSION ${PROJECT_VERSION} set_target_properties(tile PROPERTIES VERSION ${PROJECT_VERSION}
target_precompile_headers(tile PUBLIC inja/inja.h) target_precompile_headers(tile PUBLIC inja/inja.h)
@ -331,6 +333,7 @@ endfunction(add_test_group)
add_test_group(${CMAKE_CURRENT_SOURCE_DIR}/tile/net net) add_test_group(${CMAKE_CURRENT_SOURCE_DIR}/tile/net net)
add_test_group(${CMAKE_CURRENT_SOURCE_DIR}/tile/rpc rpc) add_test_group(${CMAKE_CURRENT_SOURCE_DIR}/tile/rpc rpc)
tile_add_custom_test("custom_http_client_test" "tests/http_client_test.cc") tile_add_custom_test("custom_http_client_test" "tests/http_client_test.cc")
tile_add_custom_test("tile_cpu_test" "tile/tile_cpu_test.cc")
endif(TILE_BUILD_TESTS) endif(TILE_BUILD_TESTS)
if(TILE_BUILD_BENCHMARKS) if(TILE_BUILD_BENCHMARKS)

View File

@ -17,7 +17,7 @@ namespace chrono {
class CoarseClockInitializer { class CoarseClockInitializer {
public: public:
static constexpr auto kAccuracy = std::chrono::microseconds(500); static constexpr auto kAccuracy = std::chrono::microseconds(1000);
static CoarseClockInitializer *Instance(); static CoarseClockInitializer *Instance();
// for `tile::Start()` // for `tile::Start()`

View File

@ -4,8 +4,9 @@
namespace tile { namespace tile {
static constexpr auto one_ms = std::chrono::milliseconds(1); static constexpr auto one_ms = std::chrono::milliseconds(1);
static constexpr auto kTestN = 1000; static constexpr auto diff_ms = 10;
static constexpr auto kTestN = 1000;
long long
AvageTime(std::function<long()> f, std::size_t n = kTestN) AvageTime(std::function<long()> f, std::size_t n = kTestN)
@ -21,24 +22,24 @@ AvageTime(std::function<long()> f, std::size_t n = kTestN)
TEST(SystemClock, Compare) TEST(SystemClock, Compare)
{ {
auto diff = AvageTime([] { return (ReadSystemClock() - std::chrono::system_clock::now()) / one_ms; }); auto diff = AvageTime([] { return (ReadSystemClock() - std::chrono::system_clock::now()) / one_ms; });
ASSERT_NEAR(diff, 0, 5); ASSERT_NEAR(diff, 0, diff_ms);
} }
TEST(SteadyClock, Compare) TEST(SteadyClock, Compare)
{ {
auto diff = AvageTime([] { return (ReadSteadyClock() - std::chrono::steady_clock::now()) / one_ms; }); auto diff = AvageTime([] { return (ReadSteadyClock() - std::chrono::steady_clock::now()) / one_ms; });
ASSERT_NEAR(diff, 0, 5); ASSERT_NEAR(diff, 0, diff_ms);
} }
TEST(CoarseSystemClock, Compare) TEST(CoarseSystemClock, Compare)
{ {
auto diff = AvageTime([] { return (ReadCoarseSystemClock() - std::chrono::system_clock::now()) / one_ms; }); auto diff = AvageTime([] { return (ReadCoarseSystemClock() - std::chrono::system_clock::now()) / one_ms; });
ASSERT_NEAR(diff, 0, kTestN); ASSERT_NEAR(diff, 0, kTestN * diff_ms);
} }
TEST(CoarseSteadyClock, Compare) TEST(CoarseSteadyClock, Compare)
{ {
auto diff = AvageTime([] { return (ReadCoarseSteadyClock() - std::chrono::steady_clock::now()) / one_ms; }); auto diff = AvageTime([] { return (ReadCoarseSteadyClock() - std::chrono::steady_clock::now()) / one_ms; });
ASSERT_NEAR(diff, 0, kTestN); ASSERT_NEAR(diff, 0, kTestN * diff_ms);
} }
}// namespace tile }// namespace tile

5
tile/tile_cpu_test.cc Normal file
View File

@ -0,0 +1,5 @@
#include "tile/tile.h"
#include "gtest/gtest.h"
TEST(CPU, Base) { std::this_thread::sleep_for(std::chrono::seconds(30)); }