Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
S
spdlog
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
spdlog
Commits
15d64323
Commit
15d64323
authored
May 26, 2018
by
gabime
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed bench
parent
59a15c02
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
9 additions
and
6 deletions
+9
-6
spdlog-async.cpp
bench/spdlog-async.cpp
+4
-3
spdlog-bench-mt.cpp
bench/spdlog-bench-mt.cpp
+1
-0
spdlog-bench.cpp
bench/spdlog-bench.cpp
+1
-0
spdlog-null-async.cpp
bench/spdlog-null-async.cpp
+3
-3
No files found.
bench/spdlog-async.cpp
View file @
15d64323
...
...
@@ -10,7 +10,8 @@
#include <thread>
#include <vector>
#include "spdlog/spdlog.h"
#include "spdlog/async.h"
#include "spdlog/sinks/simple_file_sink.h"
using
namespace
std
;
...
...
@@ -24,9 +25,9 @@ int main(int argc, char *argv[])
thread_count
=
std
::
atoi
(
argv
[
1
]);
int
howmany
=
1000000
;
spdlog
::
init_thread_pool
(
howmany
,
1
);
spdlog
::
set_async_mode
(
1048576
);
auto
logger
=
spdlog
::
create
<
spdlog
::
sinks
::
simple_file_sink_mt
>
(
"file_logger"
,
"logs/spdlog-bench-async.log"
,
false
);
auto
logger
=
spdlog
::
create_async_logger
<
spdlog
::
sinks
::
simple_file_sink_mt
>
(
"file_logger"
,
"logs/spdlog-bench-async.log"
,
false
);
logger
->
set_pattern
(
"[%Y-%m-%d %T.%F]: %L %t %v"
);
std
::
cout
<<
"To stop, press <Enter>"
<<
std
::
endl
;
...
...
bench/spdlog-bench-mt.cpp
View file @
15d64323
...
...
@@ -11,6 +11,7 @@
#include <vector>
#include "spdlog/spdlog.h"
#include "spdlog/sinks/simple_file_sink.h"
using
namespace
std
;
...
...
bench/spdlog-bench.cpp
View file @
15d64323
...
...
@@ -7,6 +7,7 @@
#include <iostream>
#include "spdlog/spdlog.h"
#include "spdlog/sinks/simple_file_sink.h"
int
main
(
int
,
char
*
[])
{
...
...
bench/spdlog-null-async.cpp
View file @
15d64323
...
...
@@ -9,6 +9,7 @@
#include "spdlog/async_logger.h"
#include "spdlog/sinks/null_sink.h"
#include "spdlog/spdlog.h"
#include "spdlog/async.h"
#include "utils.h"
#include <atomic>
#include <cstdlib> // EXIT_FAILURE
...
...
@@ -47,14 +48,13 @@ int main(int argc, char *argv[])
cout
<<
"async logging.. "
<<
threads
<<
" threads sharing same logger, "
<<
format
(
howmany
)
<<
" messages "
<<
endl
;
cout
<<
"*******************************************************************************
\n
"
;
spdlog
::
set_async_mode
(
queue_size
);
size_t
total_rate
=
0
;
for
(
int
i
=
0
;
i
<
iters
;
++
i
)
{
spdlog
::
init_thread_pool
(
queue_size
,
1
);
// auto as = spdlog::daily_logger_st("as", "logs/daily_async");
auto
as
=
spdlog
::
create
<
null_sink_st
>
(
"async(null-sink)"
);
auto
as
=
spdlog
::
create
_async_logger
<
null_sink_st
>
(
"async(null-sink)"
);
total_rate
+=
bench_as
(
howmany
,
as
,
threads
);
spdlog
::
drop
(
"async(null-sink)"
);
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment