Comments (9)
I'm planning to merge the cpp11-dev branch as soon as I get everything to compile on Windows. It doesn't bring a lot of changes for C11 users, but for C++ it's better.
What's the intended usage? platforms, language, type of application, etc.
from mini-async-log-c.
from mini-async-log-c.
The benchmark project is definitely referencing external projects, as some of the loggers benchmarked aren't hosted on GitHub.
On Linux you should be able to compile the benchmarks with.
mkdir build && cd build && cmake .. -DNANOLOG=on -DMALC=on && make -j
If this doesn't compile then it's broken and I'd like to know how to be able to fix it.
From the synthetic testing I have done on my obsolete AMD Phenon 965 x4 on Ubuntu Server 18.04 using the "performance" cpu governor with a peak of 100000 mesages, malc using thread local storage is 1,5-2x faster than nanolog on the single-threaded case, they get more or less equal with 8 threads, and after that nanolog wins, as it scales almost linearly with the number of threads, while malc degrades.
On this same test, when passing 8MB as a tls buffer size to malc (which is enough to handle the 100000 messages peak), malc peak memory consumption was 13MB . nanolog 32MB.
As the benchmark is just launching threads continuously logging in a loop, one has to interpret its significance when running in an application. I guess that a textual logger is almost always uncontended.
If you own the threads that are going to log, you can enable a buffer on thread local storage on malc. This makes logging wait-free as long as there is space on that thread local storage buffer. Then if you don't want to drop messages on a full buffer, as fallback you can use the heap, a shared bounded buffer or both. On nanolog there are cases that take mutexes or initialize data the first time a logging site is hit.
I'm completely biased, so it's hard for me to tell what you should be using. Consider that this is a textual logger and nanolog is binary.
For C++ usage under Linux I'd take the cpp11-dev branch, it's not going to change much more before it's merged to master.
from mini-async-log-c.
I finally got around to try and testing this a bit more throughly.
- cpp11-dev branch contains a bad submodule reference to base_library @ 6fe7d2f which doesn't exist
- master branch has a compile error with Linux RHEL 7.4 and gcc 8.3.1, details below.
[120/121] Compiling C++ object 'subprojects/base_library/b3ec909@@bl-nonblock-mpmc-bpm-relacy@exe/test_src_bl_mpmc_bpm_relacy_mpmc_bpm_relacy.cpp.o'.
FAILED: subprojects/base_library/b3ec909@@bl-nonblock-mpmc-bpm-relacy@exe/test_src_bl_mpmc_bpm_relacy_mpmc_bpm_relacy.cpp.o
c++ -Isubprojects/base_library/b3ec909@@bl-nonblock-mpmc-bpm-relacy@exe -Isubprojects/base_library -I../subprojects/base_library -I../subprojects/base_library/include -I../subprojects/base_library/src -I../subprojects/base_library/test/src -I../subprojects/base_library/dep/install/include -I../subprojects/base_library/gitmodules/relacy -fdiagnostics-color=always -pipe -D_FILE_OFFSET_BITS=64 -Wall -Winvalid-pch -Wnon-virtual-dtor -std=c++11 -g -pthread -MD -MQ 'subprojects/base_library/b3ec909@@bl-nonblock-mpmc-bpm-relacy@exe/test_src_bl_mpmc_bpm_relacy_mpmc_bpm_relacy.cpp.o' -MF 'subprojects/base_library/b3ec909@@bl-nonblock-mpmc-bpm-relacy@exe/test_src_bl_mpmc_bpm_relacy_mpmc_bpm_relacy.cpp.o.d' -o 'subprojects/base_library/b3ec909@@bl-nonblock-mpmc-bpm-relacy@exe/test_src_bl_mpmc_bpm_relacy_mpmc_bpm_relacy.cpp.o' -c ../subprojects/base_library/test/src/bl/mpmc_bpm_relacy/mpmc_bpm_relacy.cpp
In file included from /opt/rh/devtoolset-8/root/usr/include/c++/8/map:61,
from ../subprojects/base_library/gitmodules/relacy/relacy/pch.hpp:48,
from ../subprojects/base_library/gitmodules/relacy/relacy/base.hpp:16,
from ../subprojects/base_library/gitmodules/relacy/relacy/relacy.hpp:17,
from ../subprojects/base_library/test/src/bl/mpmc_bpm_relacy/mpmc_bpm_relacy.cpp:304:
/opt/rh/devtoolset-8/root/usr/include/c++/8/bits/stl_map.h: In instantiation of ‘class std::map<void*, long unsigned int, std::less<void*>, rl::raw_allocator<std::pair<void*, long unsigned int> > >’:
../subprojects/base_library/gitmodules/relacy/relacy/memory.hpp:178:30: required from here
/opt/rh/devtoolset-8/root/usr/include/c++/8/bits/stl_map.h:122:21: error: static assertion failed: std::map must have the same value_type as its allocator
static_assert(is_same<typename _Alloc::value_type, value_type>::value,
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/opt/rh/devtoolset-8/root/usr/include/c++/8/bits/stl_map.h: In instantiation of ‘class std::map<const void*, long unsigned int, std::less<const void*>, rl::raw_allocator<std::pair<const void*, long unsigned int> > >’:
../subprojects/base_library/gitmodules/relacy/relacy/context_addr_hash.hpp:55:45: required from here
/opt/rh/devtoolset-8/root/usr/include/c++/8/bits/stl_map.h:122:21: error: static assertion failed: std::map must have the same value_type as its allocator
In file included from ../subprojects/base_library/gitmodules/relacy/relacy/base.hpp:17,
from ../subprojects/base_library/gitmodules/relacy/relacy/relacy.hpp:17,
from ../subprojects/base_library/test/src/bl/mpmc_bpm_relacy/mpmc_bpm_relacy.cpp:304:
../subprojects/base_library/gitmodules/relacy/relacy/platform.hpp:247:30: warning: dynamic exception specifications are deprecated in C++11 [-Wdeprecated]
# define RL_THROW_SPEC(ex) throw(ex)
^~~~~
../subprojects/base_library/gitmodules/relacy/relacy/context.hpp:1256:41: note: in expansion of macro ‘RL_THROW_SPEC’
inline void* operator new (size_t size) RL_THROW_SPEC(std::bad_alloc)
^~~~~~~~~~~~~
../subprojects/base_library/gitmodules/relacy/relacy/platform.hpp:247:30: warning: dynamic exception specifications are deprecated in C++11 [-Wdeprecated]
# define RL_THROW_SPEC(ex) throw(ex)
^~~~~
../subprojects/base_library/gitmodules/relacy/relacy/context.hpp:1264:44: note: in expansion of macro ‘RL_THROW_SPEC’
inline void* operator new [] (size_t size) RL_THROW_SPEC(std::bad_alloc)
from mini-async-log-c.
I was moving some things from malc to the submodule under pressure (family) and I got it wrong. I was tired. I will be fixing this soon.
from mini-async-log-c.
I fixed the submodule.
It seems that the error is related to the relacy race detector. My source the only thing that does is to #include <relacy/relacy.hpp>
Unfortunately I can't reproduce.
The file failing is a test that I did for checking the correctness of a queue, it is totally unnecesary for malc, so it is safe to comment out the 'bl-nonblock-mpmc-bpm-relacy' executable on the "meson.build" file if you want to keep things going.
There is the "bare" meson option that I added that just compiles the libraries and skips all the tests. too.
If I remember correctly, I bumped "relacy" recently to see if I could get rid of those throw warnings.
I'm on gcc 7.4 myself.
from mini-async-log-c.
That's great thanks, both branches compile and tests pass once the relacy executable is disabled.
from mini-async-log-c.
7f27e6d Fixes the relacy issue. I was going to submit a fix for relacy when I realized that it was already submitted upstream.
from mini-async-log-c.
The C++11 branch is merged. Closing this.
from mini-async-log-c.
Related Issues (7)
- stress test: Missing messages for small message counts. HOT 1
- C++ compiling & CMake integration & Linking order of static dependencies HOT 10
- Linux build instructions fail on aarch64 because base library's CPU timept support is implemented only for x64/x86/IA64 HOT 3
- Tests failing on Ubuntu 22.04 HOT 2
- malcpp-example-hello-malcpp giving bl_timeout non-deterministically HOT 9
- Question about formatting HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from mini-async-log-c.