Home

Awesome

xtr

Ubuntu-GCC Ubuntu-GCC-Conan Ubuntu-GCC-CMake Ubuntu-GCC-Sanitizer

Ubuntu-Clang Ubuntu-Clang-Conan Ubuntu-Clang-CMake Ubuntu-Clang-Sanitizer

FreeBSD-14-GCC FreeBSD-14-GCC-Conan FreeBSD-14-GCC-CMake

FreeBSD-14-Clang FreeBSD-14-Clang-Conan FreeBSD-14-Clang-CMake

FreeBSD-13-GCC FreeBSD-13-Clang

codecov Documentation CodeQL

What is it?

XTR is a C++ logging library aimed at applications with low-latency or real-time requirements. The cost of log statements is minimised by delegating as much work as possible to a background thread.

It is designed so that the cost of a log statement is consistently fast---i.e. every call is fast, not just the average case. No allocations or system calls are made when a log statement is made.

Features

Supported platforms

Documentation

https://choll.github.io/xtr

Benchmarks

Below is the output of PRODUCER_CPU=2 CONSUMER_CPU=1 make benchmark_cpu on a stock Ryzen 5950X with SMT disabled, isolated cores and g++ version 11.2.0

sudo cpupower --cpu 2,1 frequency-set --governor performance
Setting cpu: 1
Setting cpu: 2
build/g++-lto-release/benchmark/benchmark
2022-04-26T22:54:43+01:00
Running build/g++-lto-release/benchmark/benchmark
Run on (16 X 5084 MHz CPU s)
CPU Caches:
  L1 Data 32 KiB (x16)
  L1 Instruction 32 KiB (x16)
  L2 Unified 512 KiB (x16)
  L3 Unified 32768 KiB (x2)
Load Average: 3.32, 2.74, 1.99
***WARNING*** CPU scaling is enabled, the benchmark real time measurements may be noisy and will incur extra overhead.
---------------------------------------------------------------------------------
Benchmark                                       Time             CPU   Iterations
---------------------------------------------------------------------------------
logger_benchmark                             2.19 ns         2.19 ns    318972090
logger_benchmark_tsc                         7.81 ns         7.81 ns     89307646
logger_benchmark_clock_realtime_coarse       8.05 ns         8.05 ns     87732373
logger_benchmark_int                         3.31 ns         3.31 ns    210259973
logger_benchmark_long                        3.33 ns         3.33 ns    209935480
logger_benchmark_double                      3.26 ns         3.26 ns    212240698
logger_benchmark_c_str                       4.86 ns         4.86 ns    146577914
logger_benchmark_str_view                    3.12 ns         3.12 ns    224958501
logger_benchmark_str                         4.36 ns         4.36 ns    158750720
logger_benchmark_non_blocking                2.01 ns         2.01 ns    349312408

Benchmarks Comparing Against Other loggers

Integer Benchmark, One Thread

Library507590959999.9MaxVersion
xtr111212.513144155.52.0.1
platformlab_nanolog11.511.5121212.514.53385b71b6
quill121313.51414.516530.5v2.0.2
reckless171717.517.519.521.538v3.0.3
ms_binlog29.5313232.568105.53842020-04-26-82-g2de2fa0
iyengar_nanolog142158173.5192.5421484414903ffc74a
spdlog284.5317346363.5399.5501.5572.5v1.10.0
g3log25432637272427792879301533541.3.4

Integer Benchmark, Four Threads

Library507590959999.9MaxVersion
xtr111212.513.514.541.5732.0.1
platformlab_nanolog11.51212.512.5131733.585b71b6
quill1314.515.516.51821.523v2.0.2
reckless1819.520.520.521.52865v3.0.3
ms_binlog29.531323370.5107.54122020-04-26-82-g2de2fa0
iyengar_nanolog135152.5172184227507.5632903ffc74a
spdlog280.5314.5342.5361.5403.5540.5669.5v1.10.0
g3log25302624271027672878301771461.3.4

String Benchmark, One Thread

Library507590959999.9MaxVersion
xtr12.513.51414.51641.5512.0.1
platformlab_nanolog13.51414.514.515.51935.585b71b6
quill14.515.51818.52021.522.5v2.0.2
ms_binlog3435.536.53875109.5389.52020-04-26-82-g2de2fa0
reckless4447.549.550.552.579.5134.5v3.0.3
iyengar_nanolog120150166.5181379.5492.5416803ffc74a
spdlog255299344373.5484.511231602v1.10.0
g3log19752214234024162536269328881.3.4

String Benchmark, Four Threads

Library507590959999.9MaxVersion
xtr1313.514.51516.546662.0.1
platformlab_nanolog13.51414.51516.5223985b71b6
quill14.515.517182021.523.5v2.0.2
ms_binlog34.53637.538.575.5115.5408.52020-04-26-82-g2de2fa0
reckless4448505152.568.5216.5v3.0.3
iyengar_nanolog96.5132.5161.5174.5229.548783543ffc74a
spdlog256301.5349.5379495.511772071v1.10.0
g3log19112245238024512582273865781.3.4

See logger_benchmarks for more details.

Installation notes

See INSTALL.md