Comments (4)
The async logger stores log messages to a task queue, and a dedicated thread pool consumes the queue and prints the log, so if a process terminates while a task is in the queue, no log will be output.
And when spdlog outputs the log to a file, the data is pooled by the OS into I/O buffer.
I/O buffer may be destroyed when the process terminates, so a flush operation on I/O buffer is required before the process terminates.
You can flush the log to a file by calling spdlog::shutdown()
at the end of the test.
See Wiki:
- https://github.com/gabime/spdlog/wiki/6.-Asynchronous-logging
- https://github.com/gabime/spdlog/wiki/7.-Flush-policy
from spdlog.
The async logger stores log messages to a task queue, and a dedicated thread pool consumes the queue and prints the log, so if a process terminates while a task is in the queue, no log will be output.
And when spdlog outputs the log to a file, the data is pooled by the OS into I/O buffer. I/O buffer may be destroyed when the process terminates, so a flush operation on I/O buffer is required before the process terminates.
You can flush the log to a file by calling
spdlog::shutdown()
at the end of the test.See Wiki:
Thanks.When I change the google benchmark to ITER_REPEAT(#define ITER_COUNT 2000 #define REPEAT_COUNT 5),the result txt like this:
2024-01-03T11:26:21+08:00
Running ./bin/gbenchmark_spdlog_async
Run on (6 X 2592.01 MHz CPU s)
CPU Caches:
L1 Data 32 KiB (x6)
L1 Instruction 32 KiB (x6)
L2 Unified 256 KiB (x6)
L3 Unified 12288 KiB (x6)
Load Average: 0.53, 1.45, 1.40
---------------------------------------------------------------------------------------------------------------
Benchmark Time CPU Iterations
---------------------------------------------------------------------------------------------------------------
SpdlogAsyncFixture/async/iterations:2000/repeats:5/threads:1 469 ns 384 ns 2000
SpdlogAsyncFixture/async/iterations:2000/repeats:5/threads:1 729 ns 456 ns 2000
SpdlogAsyncFixture/async/iterations:2000/repeats:5/threads:1 1884 ns 498 ns 2000
SpdlogAsyncFixture/async/iterations:2000/repeats:5/threads:1 648 ns 489 ns 2000
SpdlogAsyncFixture/async/iterations:2000/repeats:5/threads:1 904 ns 662 ns 2000
SpdlogAsyncFixture/async/iterations:2000/repeats:5/threads:1_mean 927 ns 498 ns 5
SpdlogAsyncFixture/async/iterations:2000/repeats:5/threads:1_median 729 ns 489 ns 5
SpdlogAsyncFixture/async/iterations:2000/repeats:5/threads:1_stddev 558 ns 102 ns 5
SpdlogAsyncFixture/async/iterations:2000/repeats:5/threads:1_cv 60.16 % 20.52 % 5
SpdlogAsyncFixture/async/iterations:2000/repeats:5/threads:3 1353 ns 1296 ns 6000
SpdlogAsyncFixture/async/iterations:2000/repeats:5/threads:3 689 ns 1093 ns 6000
SpdlogAsyncFixture/async/iterations:2000/repeats:5/threads:3 17539 ns 6305 ns 6000
SpdlogAsyncFixture/async/iterations:2000/repeats:5/threads:3 12198 ns 4501 ns 6000
SpdlogAsyncFixture/async/iterations:2000/repeats:5/threads:3 4396 ns 1790 ns 6000
SpdlogAsyncFixture/async/iterations:2000/repeats:5/threads:3_mean 7235 ns 2997 ns 5
SpdlogAsyncFixture/async/iterations:2000/repeats:5/threads:3_median 4396 ns 1790 ns 5
SpdlogAsyncFixture/async/iterations:2000/repeats:5/threads:3_stddev 7354 ns 2301 ns 5
SpdlogAsyncFixture/async/iterations:2000/repeats:5/threads:3_cv 101.64 % 76.78 % 5
SpdlogAsyncFixture/async/iterations:2000/repeats:5/threads:6 31745 ns 11515 ns 12000
SpdlogAsyncFixture/async/iterations:2000/repeats:5/threads:6 23316 ns 8245 ns 12000
SpdlogAsyncFixture/async/iterations:2000/repeats:5/threads:6 775 ns 1111 ns 12000
SpdlogAsyncFixture/async/iterations:2000/repeats:5/threads:6 19310 ns 10572 ns 12000
SpdlogAsyncFixture/async/iterations:2000/repeats:5/threads:6 27307 ns 13141 ns 12000
SpdlogAsyncFixture/async/iterations:2000/repeats:5/threads:6_mean 20491 ns 8917 ns 5
SpdlogAsyncFixture/async/iterations:2000/repeats:5/threads:6_median 23316 ns 10572 ns 5
SpdlogAsyncFixture/async/iterations:2000/repeats:5/threads:6_stddev 11950 ns 4709 ns 5
SpdlogAsyncFixture/async/iterations:2000/repeats:5/threads:6_cv 58.32 % 52.81 % 5
SpdlogAsyncFixture/async/iterations:2000/repeats:5/threads:12 24407 ns 10333 ns 24000
SpdlogAsyncFixture/async/iterations:2000/repeats:5/threads:12 22409 ns 12570 ns 24000
SpdlogAsyncFixture/async/iterations:2000/repeats:5/threads:12 19459 ns 10000 ns 24000
SpdlogAsyncFixture/async/iterations:2000/repeats:5/threads:12 9142 ns 4376 ns 24000
SpdlogAsyncFixture/async/iterations:2000/repeats:5/threads:12 19282 ns 7377 ns 24000
SpdlogAsyncFixture/async/iterations:2000/repeats:5/threads:12_mean 18940 ns 8931 ns 5
SpdlogAsyncFixture/async/iterations:2000/repeats:5/threads:12_median 19459 ns 10000 ns 5
SpdlogAsyncFixture/async/iterations:2000/repeats:5/threads:12_stddev 5880 ns 3143 ns 5
SpdlogAsyncFixture/async/iterations:2000/repeats:5/threads:12_cv 31.05 % 35.19 % 5
The all Iterations is about 220000.It equals wc - l gbenchmark_spdlog_async.log(220000).
The results means that no log are discarding.
In an other way, when I use google benchmark min_time ,the line far bigger than Iterations just becasue I don't call spdlog::shutdown()
?
from spdlog.
I am not familiar with google benchmark and this is not a google benchmark repository so the answer to that question is not here.
However, as far as google/benchmark#746 is concerned, min_time
does not specify a minimum number of iterations.
from spdlog.
Thank you for taking the time.
I'll do the rest.
Best Wishes!
from spdlog.
Related Issues (20)
- MSVC new version, warning MSVC(C4996). HOT 4
- No color with stdout_color_mt HOT 3
- 2.x branch: Some commit after 287d83 broke include directory install HOT 2
- Compiling as a library - but unresolved symbols on link HOT 2
- not support vs2013, msvc18 HOT 1
- error: declaration requires an exit-time destructor HOT 1
- dist_sink vs logger with multiple sinks HOT 2
- file logging not working when application is running as systemd service HOT 6
- force the logger to doing rotate HOT 3
- I use spdlog library in my dll project and create console by calling AllocConsole. HOT 8
- Trying to set different log levels on different sinks... but it's not working HOT 1
- inline registry leads to split instances across .so borders HOT 5
- mirror dialog needs to revert when cancel pressed HOT 2
- static function 'int spdlog::details::to12h(const tm &)' declared but not defined HOT 7
- spdlog not adaptable with newer versions of fmt HOT 6
- Some short guidance for adding sinks on the fly HOT 7
- Can not find basic_runtime under namespace fmt HOT 1
- [Possible Bug] : undesired deletion of logger from registry(loggers_ map) HOT 2
- catch program exception HOT 6
- Crash when using async_logger with threadpool HOT 6
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 spdlog.