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
a4bae6ab
Unverified
Commit
a4bae6ab
authored
Sep 25, 2018
by
Gabi Melman
Committed by
GitHub
Sep 25, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update bench.cpp
parent
808bc1f4
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
13 deletions
+4
-13
bench/bench.cpp
bench/bench.cpp
+4
-13
No files found.
bench/bench.cpp
View file @
a4bae6ab
...
@@ -32,7 +32,7 @@ void bench_mt(int howmany, std::shared_ptr<spdlog::logger> log, int thread_count
...
@@ -32,7 +32,7 @@ void bench_mt(int howmany, std::shared_ptr<spdlog::logger> log, int thread_count
int
main
(
int
argc
,
char
*
argv
[])
int
main
(
int
argc
,
char
*
argv
[])
{
{
int
howmany
=
100000
;
int
howmany
=
100000
0
;
int
queue_size
=
howmany
+
2
;
int
queue_size
=
howmany
+
2
;
int
threads
=
10
;
int
threads
=
10
;
size_t
file_size
=
30
*
1024
*
1024
;
size_t
file_size
=
30
*
1024
*
1024
;
...
@@ -54,18 +54,11 @@ int main(int argc, char *argv[])
...
@@ -54,18 +54,11 @@ int main(int argc, char *argv[])
cout
<<
"******************************************************************"
cout
<<
"******************************************************************"
"*************
\n
"
;
"*************
\n
"
;
bench
(
howmany
,
spdlog
::
create
<
null_sink_st
>
(
"null_st"
));
return
0
;
auto
rotating_st
=
spdlog
::
rotating_logger_st
(
"rotating_st"
,
"logs/rotating_st.log"
,
file_size
,
rotating_files
);
bench
(
howmany
,
rotating_st
);
return
0
;
auto
basic_st
=
spdlog
::
basic_logger_st
(
"basic_st"
,
"logs/basic_st.log"
,
true
);
auto
basic_st
=
spdlog
::
basic_logger_st
(
"basic_st"
,
"logs/basic_st.log"
,
true
);
bench
(
howmany
,
basic_st
);
bench
(
howmany
,
basic_st
);
//
auto rotating_st = spdlog::rotating_logger_st("rotating_st", "logs/rotating_st.log", file_size, rotating_files);
auto
rotating_st
=
spdlog
::
rotating_logger_st
(
"rotating_st"
,
"logs/rotating_st.log"
,
file_size
,
rotating_files
);
//
bench(howmany, rotating_st);
bench
(
howmany
,
rotating_st
);
auto
daily_st
=
spdlog
::
daily_logger_st
(
"daily_st"
,
"logs/daily_st.log"
);
auto
daily_st
=
spdlog
::
daily_logger_st
(
"daily_st"
,
"logs/daily_st.log"
);
bench
(
howmany
,
daily_st
);
bench
(
howmany
,
daily_st
);
...
@@ -110,17 +103,15 @@ int main(int argc, char *argv[])
...
@@ -110,17 +103,15 @@ int main(int argc, char *argv[])
}
}
return
EXIT_SUCCESS
;
return
EXIT_SUCCESS
;
}
}
#include "spdlog/extra/to_hex.h"
void
bench
(
int
howmany
,
std
::
shared_ptr
<
spdlog
::
logger
>
log
)
void
bench
(
int
howmany
,
std
::
shared_ptr
<
spdlog
::
logger
>
log
)
{
{
using
std
::
chrono
::
high_resolution_clock
;
using
std
::
chrono
::
high_resolution_clock
;
cout
<<
log
->
name
()
<<
"...
\t\t
"
<<
flush
;
cout
<<
log
->
name
()
<<
"...
\t\t
"
<<
flush
;
char
buf
[
1024
];
auto
start
=
high_resolution_clock
::
now
();
auto
start
=
high_resolution_clock
::
now
();
for
(
auto
i
=
0
;
i
<
howmany
;
++
i
)
for
(
auto
i
=
0
;
i
<
howmany
;
++
i
)
{
{
log
->
info
(
"Hello logger: msg number {}"
,
spdlog
::
to_hex
(
buf
)
);
log
->
info
(
"Hello logger: msg number {}"
,
i
);
}
}
auto
delta
=
high_resolution_clock
::
now
()
-
start
;
auto
delta
=
high_resolution_clock
::
now
()
-
start
;
...
...
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