Git Product home page Git Product logo

Comments (4)

tt4g avatar tt4g commented on June 3, 2024

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:

from spdlog.

chaotianjiao avatar chaotianjiao commented on June 3, 2024

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.

tt4g avatar tt4g commented on June 3, 2024

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.

chaotianjiao avatar chaotianjiao commented on June 3, 2024

Thank you for taking the time.
I'll do the rest.
Best Wishes!

from spdlog.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.