Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
spdlog
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Libraries
spdlog
Commits
80f19d71
Commit
80f19d71
authored
May 26, 2018
by
gabime
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
updated null-async bench command line flags
parent
15d64323
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
27 additions
and
13 deletions
+27
-13
bench/spdlog-null-async.cpp
bench/spdlog-null-async.cpp
+27
-13
No files found.
bench/spdlog-null-async.cpp
View file @
80f19d71
...
...
@@ -6,10 +6,10 @@
//
// bench.cpp : spdlog benchmarks
//
#include "spdlog/async.h"
#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
...
...
@@ -29,33 +29,47 @@ size_t bench_as(int howmany, std::shared_ptr<spdlog::logger> log, int thread_cou
int
main
(
int
argc
,
char
*
argv
[])
{
int
queue_size
=
1048576
;
int
howmany
=
1000000
;
int
threads
=
10
;
int
howmany
;
int
tp_queue_size
;
int
tp_threads
=
1
;
int
client_threads
=
10
;
int
iters
=
10
;
try
{
if
(
argc
<
2
)
{
cout
<<
"Usage: "
<<
argv
[
0
]
<<
" <howmany> [q_size] [client_threads] [tp_threads]"
<<
endl
;
return
(
1
);
}
if
(
argc
>
1
)
howmany
=
atoi
(
argv
[
1
]);
howmany
=
atoi
(
argv
[
1
]);
if
(
argc
>
2
)
threads
=
atoi
(
argv
[
2
]);
client_threads
=
atoi
(
argv
[
2
]);
if
(
argc
>
3
)
queue_size
=
atoi
(
argv
[
3
]);
tp_queue_size
=
atoi
(
argv
[
3
]);
else
tp_queue_size
=
howmany
;
if
(
argc
>
4
)
tp_threads
=
atoi
(
argv
[
4
]);
cout
<<
"
\n
*******************************************************************************
\n
"
;
cout
<<
"async logging.. "
<<
threads
<<
" threads sharing same logger, "
<<
format
(
howmany
)
<<
" messages "
<<
endl
;
cout
<<
"client_threads:
\t
"
<<
client_threads
<<
endl
;
cout
<<
"messages:
\t
"
<<
format
(
howmany
)
<<
endl
;
cout
<<
"tp queue:
\t
"
<<
format
(
tp_queue_size
)
<<
endl
;
cout
<<
"tp threads:
\t
"
<<
tp_threads
<<
endl
;
cout
<<
"*******************************************************************************
\n
"
;
size_t
total_rate
=
0
;
for
(
int
i
=
0
;
i
<
iters
;
++
i
)
{
spdlog
::
init_thread_pool
(
queue_size
,
1
);
spdlog
::
init_thread_pool
(
tp_queue_size
,
tp_threads
);
// auto as = spdlog::daily_logger_st("as", "logs/daily_async");
auto
as
=
spdlog
::
create_async_logger
<
null_sink_st
>
(
"async(null-sink)"
);
total_rate
+=
bench_as
(
howmany
,
as
,
threads
);
auto
as
=
spdlog
::
create_async_logger
<
null_sink_st
>
(
"async(null-sink)"
);
total_rate
+=
bench_as
(
howmany
,
as
,
client_
threads
);
spdlog
::
drop
(
"async(null-sink)"
);
}
std
::
cout
<<
endl
;
...
...
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