diff --git a/.github/workflows/bsd.yml b/.github/workflows/bsd.yml new file mode 100644 index 00000000..8b1027fa --- /dev/null +++ b/.github/workflows/bsd.yml @@ -0,0 +1,113 @@ +name: BSD + +on: + push: + branches: + - master + paths-ignore: + - '**.md' + - 'docs/**' + - 'scripts/**' + pull_request: + branches: + - master + paths-ignore: + - '**.md' + - 'docs/**' + - 'scripts/**' + +jobs: + FreeBSD: + runs-on: ubuntu-latest + strategy: + matrix: + build_type: [ Release ] + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: FreeBSD Build and Test (${{ matrix.build_type }}) + uses: vmactions/freebsd-vm@v1 + with: + release: '14.2' + arch: 'x86_64' + mem: 16384 + cpu: 4 + usesh: true + prepare: | + pkg install -y cmake + run: | + cmake -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} -DCMAKE_CXX_STANDARD=17 -DQUILL_VERBOSE_MAKEFILE=ON -DQUILL_BUILD_TESTS=ON -DQUILL_BUILD_EXAMPLES=ON "$GITHUB_WORKSPACE" + cmake --build . --config ${{ matrix.build_type }} --parallel 4 + ctest --build-config ${{ matrix.build_type }} --output-on-failure -R "^multi_frontend_threads$" + + NetBSD: + runs-on: ubuntu-latest + strategy: + matrix: + build_type: [ Release ] + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: NetBSD Build and Test (${{ matrix.build_type }}) + uses: vmactions/netbsd-vm@v1 + with: + release: '10.0' + arch: 'x86_64' + mem: 16384 + cpu: 4 + usesh: true + prepare: | + /usr/sbin/pkg_add cmake + run: | + cmake -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} -DCMAKE_CXX_STANDARD=17 -DQUILL_VERBOSE_MAKEFILE=ON -DQUILL_BUILD_TESTS=ON -DQUILL_BUILD_EXAMPLES=ON "$GITHUB_WORKSPACE" + cmake --build . --config ${{ matrix.build_type }} --parallel 4 + ctest --build-config ${{ matrix.build_type }} --output-on-failure -R "^multi_frontend_threads$" + + OpenBSD: + runs-on: ubuntu-latest + strategy: + matrix: + build_type: [ Release ] + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: OpenBSD Build and Test (${{ matrix.build_type }}) + uses: vmactions/openbsd-vm@v1 + with: + release: '7.5' + arch: 'x86_64' + mem: 16384 + cpu: 4 + usesh: true + prepare: | + pkg_add cmake + run: | + cmake -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} -DCMAKE_CXX_STANDARD=17 -DQUILL_VERBOSE_MAKEFILE=ON -DQUILL_BUILD_TESTS=ON -DQUILL_BUILD_EXAMPLES=ON "$GITHUB_WORKSPACE" + cmake --build . --config ${{ matrix.build_type }} --parallel 4 + ctest --build-config ${{ matrix.build_type }} --output-on-failure -R "^multi_frontend_threads$" + + DragonFlyBSD: + runs-on: ubuntu-latest + strategy: + matrix: + build_type: [ Release ] + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: DragonFly Build and Test (${{ matrix.build_type }}) + uses: vmactions/dragonflybsd-vm@v1 + with: + release: '6.4.0' + mem: 16384 + cpu: 4 + usesh: true + prepare: | + pkg install -y cmake gcc10 + run: | + cmake -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} -DCMAKE_C_COMPILER=$(which gcc10) -DCMAKE_CXX_COMPILER=$(which g++10) -DCMAKE_CXX_STANDARD=17 -DQUILL_VERBOSE_MAKEFILE=ON -DQUILL_BUILD_TESTS=ON -DQUILL_BUILD_EXAMPLES=ON "$GITHUB_WORKSPACE" + cmake --build . --config ${{ matrix.build_type }} --parallel 4 + ctest --build-config ${{ matrix.build_type }} --output-on-failure -R "^multi_frontend_threads$" diff --git a/.github/workflows/coverage.yml b/.github/workflows/coverage.yml index 929dca6b..d3218844 100644 --- a/.github/workflows/coverage.yml +++ b/.github/workflows/coverage.yml @@ -1,4 +1,4 @@ -name: coverage +name: Coverage on: push: @@ -7,6 +7,7 @@ on: paths-ignore: - '**.md' - 'docs/**' + - 'scripts/**' jobs: build: diff --git a/.github/workflows/macos.yml b/.github/workflows/macos.yml index 0a67fecd..a49322d0 100644 --- a/.github/workflows/macos.yml +++ b/.github/workflows/macos.yml @@ -1,4 +1,4 @@ -name: macos +name: macOS on: push: @@ -7,6 +7,7 @@ on: paths-ignore: - '**.md' - 'docs/**' + - 'scripts/**' pull_request: branches: @@ -14,6 +15,7 @@ on: paths-ignore: - '**.md' - 'docs/**' + - 'scripts/**' jobs: build: diff --git a/.github/workflows/linux.yml b/.github/workflows/ubuntu.yml similarity index 98% rename from .github/workflows/linux.yml rename to .github/workflows/ubuntu.yml index 52e83f27..71450cb0 100644 --- a/.github/workflows/linux.yml +++ b/.github/workflows/ubuntu.yml @@ -1,4 +1,4 @@ -name: linux +name: Ubuntu on: push: @@ -7,6 +7,7 @@ on: paths-ignore: - '**.md' - 'docs/**' + - 'scripts/**' pull_request: branches: @@ -14,6 +15,7 @@ on: paths-ignore: - '**.md' - 'docs/**' + - 'scripts/**' jobs: build: diff --git a/.github/workflows/windows.yml b/.github/workflows/windows.yml index 960f1031..c80b316e 100644 --- a/.github/workflows/windows.yml +++ b/.github/workflows/windows.yml @@ -1,5 +1,4 @@ - -name: windows +name: Windows on: push: @@ -8,6 +7,7 @@ on: paths-ignore: - '**.md' - 'docs/**' + - 'scripts/**' pull_request: branches: @@ -15,6 +15,7 @@ on: paths-ignore: - '**.md' - 'docs/**' + - 'scripts/**' jobs: msvc: diff --git a/CMakeLists.txt b/CMakeLists.txt index 3b34439e..ca8dbe2e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -187,6 +187,7 @@ set(HEADER_FILES include/quill/core/Attributes.h include/quill/core/BoundedSPSCQueue.h + include/quill/core/ChronoTimeUtils.h include/quill/core/Common.h include/quill/core/DynamicFormatArgStore.h include/quill/core/Codec.h diff --git a/README.md b/README.md index 489decf4..aaf2f28e 100644 --- a/README.md +++ b/README.md @@ -1,19 +1,26 @@
+ +
- logo + Quill C++ Logging Library

Quill

-

Asynchronous Low Latency C++ Logging Library

- - linux-ci + + linux-ci + + + bsd-ci - macos-ci + macos-ci - windows-ci + windows-ci
@@ -26,7 +33,7 @@ CodeFactor - +
@@ -38,20 +45,21 @@
-

+

๐Ÿ“š Documentation - ยท + ยท โšก Cheat Sheet - ยท + ยท ๐Ÿ› Report Bug - ยท + ยท ๐Ÿ’ก Request Feature

-
- +
Logging Demo
+--- + ## ๐Ÿงญ Table of Contents - [Introduction](#-introduction) @@ -63,10 +71,11 @@ - [Caveats](#-caveats) - [License](#-license) +--- + ## โœจ Introduction -Quill is a high-performance asynchronous logging library. It is particularly suited for performance-critical -applications where every microsecond counts. +**Quill** is a **high-performance asynchronous logging library** written in **C++**. It is designed for low-latency, performance-critical applications where every microsecond counts. - **Performance-Focused**: Quill consistently outperforms many popular logging libraries. - **Feature-Rich**: Packed with advanced features to meet diverse logging needs. @@ -76,6 +85,8 @@ applications where every microsecond counts. Try it on [Compiler Explorer](https://godbolt.org/z/szncr8c8d) +--- + ## โฉ Quick Start Getting started is easy and straightforward. Follow these steps to integrate the library into your project: @@ -118,6 +129,8 @@ int main() } ``` +--- + ## ๐ŸŽฏ Features - **High-Performance**: Ultra-low latency performance. View [Benchmarks](http://github.com/odygrd/quill#performance) @@ -147,6 +160,8 @@ int main() - **Clean Codebase**: Maintained to high standards, warning-free even at strict levels. - **Type-Safe API**: Built on [{fmt}](http://github.com/fmtlib/fmt) library. +--- + ## ๐Ÿš€ Performance ### System Configuration @@ -374,6 +389,8 @@ If Quill were not available, MS BinLog would be a strong alternative. It deliver generates smaller binary log files. However, the binary logs necessitate offline processing with additional tools, which can be less convenient. +--- + ## ๐Ÿงฉ Usage Also, see the [Quick Start Guide](https://quillcpp.readthedocs.io/en/latest/quick_start.html) for a brief introduction. @@ -563,6 +580,8 @@ For manual setup, add Quill to your `BUILD.bazel` file like this: cc_binary(name = "app", srcs = ["main.cpp"], deps = ["//quill_path:quill"]) ``` +--- + ## ๐Ÿ“ Design ### Frontend (caller-thread) @@ -588,6 +607,8 @@ Subsequently, forwards the log message to all Sinks associated with the Logger. ![design.jpg](docs%2Fdesign.jpg) +--- + ## ๐Ÿšจ Caveats Quill may not work well with `fork()` since it spawns a background thread and `fork()` doesn't work well with @@ -638,6 +659,8 @@ int main() } ``` +--- + ## ๐Ÿ“ License Quill is licensed under the [MIT License](http://opensource.org/licenses/MIT) diff --git a/include/quill/Logger.h b/include/quill/Logger.h index 4e045149..b744eec1 100644 --- a/include/quill/Logger.h +++ b/include/quill/Logger.h @@ -8,6 +8,7 @@ #include "quill/UserClockSource.h" #include "quill/core/Attributes.h" +#include "quill/core/ChronoTimeUtils.h" #include "quill/core/Codec.h" #include "quill/core/Common.h" #include "quill/core/FrontendOptions.h" @@ -108,9 +109,7 @@ class LoggerImpl : public detail::LoggerBase } else if (clock_source == ClockSourceType::System) { - current_timestamp = static_cast(std::chrono::duration_cast( - std::chrono::system_clock::now().time_since_epoch()) - .count()); + current_timestamp = detail::get_timestamp_ns(); } else { diff --git a/include/quill/StopWatch.h b/include/quill/StopWatch.h index 189917cd..49b52b40 100644 --- a/include/quill/StopWatch.h +++ b/include/quill/StopWatch.h @@ -6,6 +6,7 @@ #pragma once +#include #include #include "quill/DeferredFormatCodec.h" @@ -13,6 +14,7 @@ #include "quill/core/Attributes.h" #include "quill/core/Common.h" #include "quill/core/Rdtsc.h" +#include "quill/core/ChronoTimeUtils.h" #include "quill/bundled/fmt/format.h" #include "quill/std/Chrono.h" @@ -58,9 +60,7 @@ class StopWatch } else { - _start_tp = std::chrono::duration_cast( - std::chrono::steady_clock::now().time_since_epoch()) - .count(); + _start_tp = detail::get_timestamp_ns(); } } @@ -78,7 +78,7 @@ class StopWatch else { return std::chrono::duration(std::chrono::nanoseconds{ - std::chrono::steady_clock::now().time_since_epoch().count() - _start_tp}); + detail::get_timestamp_ns() - _start_tp}); } } @@ -97,7 +97,7 @@ class StopWatch else { return std::chrono::duration_cast(std::chrono::nanoseconds{ - std::chrono::steady_clock::now().time_since_epoch().count() - _start_tp}); + detail::get_timestamp_ns() - _start_tp}); } } @@ -112,9 +112,7 @@ class StopWatch } else { - _start_tp = std::chrono::duration_cast( - std::chrono::steady_clock::now().time_since_epoch()) - .count(); + _start_tp = detail::get_timestamp_ns(); } } diff --git a/include/quill/backend/BackendUtilities.h b/include/quill/backend/BackendUtilities.h index 37bbe9f4..6e828e7d 100644 --- a/include/quill/backend/BackendUtilities.h +++ b/include/quill/backend/BackendUtilities.h @@ -35,21 +35,13 @@ #elif defined(__CYGWIN__) #include #include -#elif defined(__linux__) - #include - #include - #include -#elif defined(__NetBSD__) - #include - #include -#elif defined(__FreeBSD__) +#elif defined(__FreeBSD__) || defined(__DragonFly__) || defined(__OpenBSD__) #include #include #include -#elif defined(__DragonFly__) - #include - #include #else + // linux, anything else + #include #include #include #endif @@ -90,6 +82,12 @@ QUILL_ATTRIBUTE_COLD inline void set_cpu_affinity(uint16_t cpu_id) #if defined(__NetBSD__) cpuset_t* cpuset; cpuset = cpuset_create(); + if (cpuset == nullptr) + { + QUILL_THROW(QuillError{"Failed to create cpuset"}); + } + cpuset_zero(cpuset); + cpuset_set(cpu_id, cpuset); auto const err = pthread_setaffinity_np(pthread_self(), cpuset_size(cpuset), cpuset); cpuset_destroy(cpuset); #elif defined(__FreeBSD__) @@ -97,6 +95,10 @@ QUILL_ATTRIBUTE_COLD inline void set_cpu_affinity(uint16_t cpu_id) CPU_ZERO(&cpuset); CPU_SET(cpu_id, &cpuset); auto const err = pthread_setaffinity_np(pthread_self(), sizeof(cpuset_t), &cpuset); + #elif defined(__OpenBSD__) + // OpenBSD doesn't support CPU affinity, so we'll use a placeholder + (void)cpu_id; + auto const err = 0; // Assume success #else cpu_set_t cpuset; CPU_ZERO(&cpuset); @@ -144,18 +146,25 @@ QUILL_ATTRIBUTE_COLD inline void set_thread_name(char const* name) std::strncpy(truncated_name, name, 15); truncated_name[15] = '\0'; - #if defined(__FreeBSD__) + #if defined(__OpenBSD__) pthread_set_name_np(pthread_self(), name); - auto const res = 0; + #elif defined(__NetBSD__) + auto const res = pthread_setname_np(pthread_self(), name, nullptr); + + if (res != 0) + { + QUILL_THROW(QuillError{std::string{"Failed to set thread name - error: " + std::to_string(res) + + " error: " + strerror(res)}}); + } #else auto const res = pthread_setname_np(pthread_self(), name); - #endif if (res != 0) { QUILL_THROW(QuillError{std::string{"Failed to set thread name - error: " + std::to_string(res) + " error: " + strerror(res)}}); } + #endif #endif } diff --git a/include/quill/backend/BackendWorker.h b/include/quill/backend/BackendWorker.h index 3cb2c3f9..eff4234a 100644 --- a/include/quill/backend/BackendWorker.h +++ b/include/quill/backend/BackendWorker.h @@ -21,6 +21,7 @@ #include "quill/core/Attributes.h" #include "quill/core/BoundedSPSCQueue.h" +#include "quill/core/ChronoTimeUtils.h" #include "quill/core/Codec.h" #include "quill/core/Common.h" #include "quill/core/DynamicFormatArgStore.h" @@ -416,9 +417,7 @@ class BackendWorker QUILL_ATTRIBUTE_HOT size_t _populate_transit_events_from_frontend_queues() { uint64_t const ts_now = _options.log_timestamp_ordering_grace_period.count() - ? static_cast((std::chrono::duration_cast( - std::chrono::system_clock::now().time_since_epoch()) - - _options.log_timestamp_ordering_grace_period) + ? static_cast((detail::get_timestamp() - _options.log_timestamp_ordering_grace_period) .count()) : std::numeric_limits::max(); diff --git a/include/quill/backend/RdtscClock.h b/include/quill/backend/RdtscClock.h index 645612d1..ff380b2c 100644 --- a/include/quill/backend/RdtscClock.h +++ b/include/quill/backend/RdtscClock.h @@ -7,6 +7,7 @@ #pragma once #include "quill/core/Attributes.h" +#include "quill/core/ChronoTimeUtils.h" #include "quill/core/Common.h" #include "quill/core/Rdtsc.h" @@ -59,19 +60,16 @@ class RdtscClock for (size_t i = 0; i < trials; ++i) { - auto const beg_ts = - std::chrono::nanoseconds{std::chrono::steady_clock::now().time_since_epoch().count()}; + auto const beg_ts = detail::get_timestamp(); uint64_t const beg_tsc = rdtsc(); - - std::chrono::nanoseconds elapsed_ns; uint64_t end_tsc; + std::chrono::nanoseconds elapsed_ns; + do { - auto const end_ts = - std::chrono::nanoseconds{std::chrono::steady_clock::now().time_since_epoch().count()}; + auto const end_ts = detail::get_timestamp(); end_tsc = rdtsc(); - - elapsed_ns = end_ts - beg_ts; // calculates ns between two timespecs + elapsed_ns = end_ts - beg_ts; } while (elapsed_ns < spin_duration); // busy spin for 10ms rates[i] = static_cast(end_tsc - beg_tsc) / static_cast(elapsed_ns.count()); @@ -163,8 +161,7 @@ class RdtscClock { uint64_t const beg = rdtsc(); // we force convert to nanoseconds because the precision of system_clock::time-point is not portable across platforms. - int64_t const wall_time = - std::chrono::nanoseconds{std::chrono::system_clock::now().time_since_epoch()}.count(); + auto const wall_time = static_cast(detail::get_timestamp_ns()); uint64_t const end = rdtsc(); if (QUILL_LIKELY(end - beg <= lag)) diff --git a/include/quill/backend/ThreadUtilities.h b/include/quill/backend/ThreadUtilities.h index f5613916..017ba2be 100644 --- a/include/quill/backend/ThreadUtilities.h +++ b/include/quill/backend/ThreadUtilities.h @@ -31,19 +31,26 @@ #include #include #include -#elif defined(__linux__) - #include - #include - #include #elif defined(__NetBSD__) #include + #include #include #elif defined(__FreeBSD__) + #include #include #include #elif defined(__DragonFly__) + #include #include #include +#elif defined(__OpenBSD__) + #include + #include +#else + // linux + #include + #include + #include #endif QUILL_BEGIN_NAMESPACE @@ -159,7 +166,7 @@ QUILL_NODISCARD QUILL_EXPORT QUILL_ATTRIBUTE_USED inline std::string get_thread_ #else // Apple, linux char thread_name[16] = {'\0'}; - #if defined(__FreeBSD__) + #if defined(__OpenBSD__) pthread_get_name_np(pthread_self(), &thread_name[0], 16); #else auto res = pthread_getname_np(pthread_self(), &thread_name[0], 16); @@ -197,6 +204,8 @@ QUILL_NODISCARD QUILL_EXPORT QUILL_ATTRIBUTE_USED inline uint32_t get_thread_id( return static_cast(lwpid); #elif defined(__DragonFly__) return static_cast(lwp_gettid()); +#elif defined(__OpenBSD__) + return static_cast(getthrid()); #else return reinterpret_cast(pthread_self()); // (Ab)use pthread_self as a last resort option #endif diff --git a/include/quill/core/BoundedSPSCQueue.h b/include/quill/core/BoundedSPSCQueue.h index f39bc10f..6bc3642b 100644 --- a/include/quill/core/BoundedSPSCQueue.h +++ b/include/quill/core/BoundedSPSCQueue.h @@ -15,29 +15,8 @@ #if defined(_WIN32) #include -#elif defined(__APPLE__) - #include - #include -#elif defined(__CYGWIN__) - #include - #include -#elif defined(__linux__) - #include -#elif defined(__NetBSD__) - #include - #include - #include -#elif defined(__FreeBSD__) - #include - #include - #include -#elif defined(__DragonFly__) - #include - #include - #include #else #include - #include #include #endif diff --git a/include/quill/core/ChronoTimeUtils.h b/include/quill/core/ChronoTimeUtils.h new file mode 100644 index 00000000..3730bfd3 --- /dev/null +++ b/include/quill/core/ChronoTimeUtils.h @@ -0,0 +1,31 @@ +/** + * @page copyright + * Copyright(c) 2020-present, Odysseas Georgoudis & quill contributors. + * Distributed under the MIT License (http://opensource.org/licenses/MIT) + */ + +#pragma once + +#include "quill/core/Attributes.h" + +#include +#include + +QUILL_BEGIN_NAMESPACE + +namespace detail +{ +template +QUILL_NODISCARD QUILL_ATTRIBUTE_HOT std::chrono::nanoseconds get_timestamp() noexcept +{ + return std::chrono::duration_cast(TClock::now().time_since_epoch()); +} + +template +QUILL_NODISCARD QUILL_ATTRIBUTE_HOT uint64_t get_timestamp_ns() noexcept +{ + return static_cast(get_timestamp().count()); +} +} // namespace detail + +QUILL_END_NAMESPACE \ No newline at end of file diff --git a/include/quill/core/Rdtsc.h b/include/quill/core/Rdtsc.h index 64750df3..94618568 100644 --- a/include/quill/core/Rdtsc.h +++ b/include/quill/core/Rdtsc.h @@ -7,21 +7,11 @@ #pragma once #include "quill/core/Attributes.h" - #include -#if defined(__aarch64__) - #include - #include -#elif defined(__ARM_ARCH) - #include - #include -#elif (defined(_M_ARM) || defined(_M_ARM64)) - #include - #include -#elif (defined(__PPC64__)) +#if (defined(__ARM_ARCH) || defined(_M_ARM) || defined(_M_ARM64) || defined(__PPC64__)) + #include "quill/core/ChronoTimeUtils.h" #include - #include #else // assume x86-64 .. #if defined(_WIN32) @@ -70,13 +60,13 @@ QUILL_NODISCARD QUILL_ATTRIBUTE_HOT inline uint64_t rdtsc() noexcept #endif // soft failover - return static_cast(std::chrono::system_clock::now().time_since_epoch().count()); + return detail::get_timestamp_ns(); } #elif (defined(_M_ARM) || defined(_M_ARM64) || defined(__PPC64__)) QUILL_NODISCARD QUILL_ATTRIBUTE_HOT inline uint64_t rdtsc() noexcept { // soft failover - return static_cast(std::chrono::system_clock::now().time_since_epoch().count()); + return detail::get_timestamp_ns(); } #else /** diff --git a/include/quill/sinks/FileSink.h b/include/quill/sinks/FileSink.h index da46cfaa..2e820e6c 100644 --- a/include/quill/sinks/FileSink.h +++ b/include/quill/sinks/FileSink.h @@ -37,18 +37,6 @@ #include #include -#elif defined(__APPLE__) - #include -#elif defined(__CYGWIN__) - #include -#elif defined(__linux__) - #include -#elif defined(__NetBSD__) - #include -#elif defined(__FreeBSD__) - #include -#elif defined(__DragonFly__) - #include #else #include #endif diff --git a/test/integration_tests/BackendExceptionNotifierTest.cpp b/test/integration_tests/BackendExceptionNotifierTest.cpp index a924af4b..d1d22dd1 100644 --- a/test/integration_tests/BackendExceptionNotifierTest.cpp +++ b/test/integration_tests/BackendExceptionNotifierTest.cpp @@ -39,7 +39,7 @@ TEST_CASE("backend_exception_notifier") // Set invalid thread name BackendOptions backend_options; - #if !defined(__FreeBSD__) + #if !(defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__DragonFly__)) // On FreeBSD CPU_SET(cpu_id, &cpuset); with a big number crashes. // Setting to an invalid CPU. When we call quill::start() our error handler will be invoked and an error will be logged backend_options.cpu_affinity = static_cast(std::numeric_limits::max() - 1); @@ -68,7 +68,7 @@ TEST_CASE("backend_exception_notifier") LOG_INFO(logger, "frontend"); logger->flush_log(); - #if !defined(__FreeBSD__) + #if !(defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__DragonFly__)) // Check our handler was invoked since either set_backend_thread_name or set_backend_thread_cpu_affinity should have failed REQUIRE_GE(error_notifier_invoked.load(), 1); #endif @@ -99,7 +99,7 @@ TEST_CASE("backend_exception_notifier") std::vector const file_contents = quill::testing::file_contents(filename); - #if !defined(__FreeBSD__) + #if !(defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__DragonFly__)) // Look for the async errors std::string const expected_string_1 = "error handler invoked Failed to set cpu affinity "; std::string const expected_string_2 = "error handler invoked Failed to set thread name "; diff --git a/test/integration_tests/SignalHandlerLoggerTest.cpp b/test/integration_tests/SignalHandlerLoggerTest.cpp index bead501e..3b99e32d 100644 --- a/test/integration_tests/SignalHandlerLoggerTest.cpp +++ b/test/integration_tests/SignalHandlerLoggerTest.cpp @@ -87,7 +87,7 @@ TEST_CASE("signal_handler_logger") #elif defined(__apple_build_version__) REQUIRE(quill::testing::file_contains( file_contents_b, std::string{"Received signal: Abort trap: 6 (signum: 6)"})); -#elif defined(__FreeBSD__) +#elif defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__DragonFly__) REQUIRE(quill::testing::file_contains(file_contents_b, std::string{"Received signal: Abort trap (signum: 6)"})); #else REQUIRE(quill::testing::file_contains(file_contents_b, std::string{"Received signal: Aborted (signum: 6)"})); diff --git a/test/integration_tests/SignalHandlerTest.cpp b/test/integration_tests/SignalHandlerTest.cpp index 952ca6d3..622074b8 100644 --- a/test/integration_tests/SignalHandlerTest.cpp +++ b/test/integration_tests/SignalHandlerTest.cpp @@ -117,7 +117,7 @@ TEST_CASE("signal_handler") REQUIRE(quill::testing::file_contains(file_contents, std::string{"Received signal: 22 (signum: 22)"})); #elif defined(__apple_build_version__) REQUIRE(quill::testing::file_contains(file_contents, std::string{"Received signal: Abort trap: 6 (signum: 6)"})); -#elif defined(__FreeBSD__) +#elif defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__DragonFly__) REQUIRE(quill::testing::file_contains(file_contents, std::string{"Received signal: Abort trap (signum: 6)"})); #else REQUIRE(quill::testing::file_contains(file_contents, std::string{"Received signal: Aborted (signum: 6)"})); diff --git a/test/unit_tests/RdtscClockTest.cpp b/test/unit_tests/RdtscClockTest.cpp index a07f0f8d..f1c26ba0 100644 --- a/test/unit_tests/RdtscClockTest.cpp +++ b/test/unit_tests/RdtscClockTest.cpp @@ -11,7 +11,7 @@ void check_wall_time_now(quill::detail::RdtscClock const& tsc_clock, size_t& fai { std::chrono::milliseconds constexpr offset{10}; - auto const wall_time_chrono = std::chrono::system_clock::now().time_since_epoch(); + auto const wall_time_chrono = quill::detail::get_timestamp(); auto const wall_time_tsc = std::chrono::nanoseconds{tsc_clock.time_since_epoch(quill::detail::rdtsc())}; auto const lower_bound = wall_time_chrono - offset;