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
0926a6e2
Commit
0926a6e2
authored
Nov 24, 2014
by
gabime
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added async to benchmarks
parent
c56fae39
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
92 additions
and
9 deletions
+92
-9
bench/Makefile
bench/Makefile
+8
-2
bench/run_all.sh
bench/run_all.sh
+15
-6
bench/spdlog-bench-async.cpp
bench/spdlog-bench-async.cpp
+18
-0
bench/spdlog-bench-mt-async.cpp
bench/spdlog-bench-mt-async.cpp
+50
-0
bench/spdlog-bench.cpp
bench/spdlog-bench.cpp
+1
-1
No files found.
bench/Makefile
View file @
0926a6e2
...
@@ -3,13 +3,19 @@ CXXFLAGS = -march=native -Wall -Wextra -Wshadow -pedantic -std=c++11 -pthread -W
...
@@ -3,13 +3,19 @@ CXXFLAGS = -march=native -Wall -Wextra -Wshadow -pedantic -std=c++11 -pthread -W
CXX_RELEASE_FLAGS
=
-O3
-flto
CXX_RELEASE_FLAGS
=
-O3
-flto
all
:
spdlog-bench spdlog-bench-mt boost-bench boost-bench-mt glog-bench glog-bench-mt
all
:
spdlog-bench spdlog-bench-mt
spdlog-bench-async spdlog-bench-mt-async
boost-bench boost-bench-mt glog-bench glog-bench-mt
spdlog-bench
:
spdlog-bench.cpp
spdlog-bench
:
spdlog-bench.cpp
$(CXX)
spdlog-bench.cpp
-o
spdlog-bench
$(CXXFLAGS)
$(CXX_RELEASE_FLAGS)
$(CXX)
spdlog-bench.cpp
-o
spdlog-bench
$(CXXFLAGS)
$(CXX_RELEASE_FLAGS)
spdlog-bench-mt
:
spdlog-bench-mt.cpp
spdlog-bench-mt
:
spdlog-bench-mt.cpp
$(CXX)
spdlog-bench-mt.cpp
-o
spdlog-bench-mt
$(CXXFLAGS)
$(CXX_RELEASE_FLAGS)
$(CXX)
spdlog-bench-mt.cpp
-o
spdlog-bench-mt
$(CXXFLAGS)
$(CXX_RELEASE_FLAGS)
spdlog-bench-async
:
spdlog-bench-async.cpp
$(CXX)
spdlog-bench-async.cpp
-o
spdlog-bench-async
$(CXXFLAGS)
$(CXX_RELEASE_FLAGS)
spdlog-bench-mt-async
:
spdlog-bench-mt-async.cpp
$(CXX)
spdlog-bench-mt-async.cpp
-o
spdlog-bench-mt-async
$(CXXFLAGS)
$(CXX_RELEASE_FLAGS)
BOOST_FLAGS
=
-DBOOST_LOG_DYN_LINK
-I
/home/gabi/devel/boost_1_56_0/
-L
/home/gabi/devel/boost_1_56_0/stage/lib
-lboost_log
-lboost_log_setup
-lboost_filesystem
-lboost_system
-lboost_thread
-lboost_regex
-lboost_date_time
-lboost_chrono
BOOST_FLAGS
=
-DBOOST_LOG_DYN_LINK
-I
/home/gabi/devel/boost_1_56_0/
-L
/home/gabi/devel/boost_1_56_0/stage/lib
-lboost_log
-lboost_log_setup
-lboost_filesystem
-lboost_system
-lboost_thread
-lboost_regex
-lboost_date_time
-lboost_chrono
...
...
bench/run_all.sh
View file @
0926a6e2
...
@@ -3,27 +3,36 @@ echo "Running benchmakrs (all with 1000,000 writes to the logs folder"
...
@@ -3,27 +3,36 @@ echo "Running benchmakrs (all with 1000,000 writes to the logs folder"
echo
echo
echo
"boost-bench (single thread).."
echo
"boost-bench (single thread).."
time
./boost-bench
time
./boost-bench
echo
==================================
echo
echo
sleep
3
sleep
3
echo
"glog-bench (single thread).."
echo
"glog-bench (single thread).."
time
./glog-bench
time
./glog-bench
echo
==================================
echo
echo
sleep
3
sleep
3
echo
"spdlog-bench (single thread)"
echo
"spdlog-bench (single thread)"
time
./spdlog-bench
time
./spdlog-bench
echo
==================================
echo
echo
sleep
3
sleep
3
echo
"boost-bench-mt (10 threads, single logger)"
..
echo
"boost-bench-mt (10 threads, single logger)"
..
time
./boost-bench-mt
time
./boost-bench-mt
echo
==================================
echo
echo
sleep
3
sleep
3
echo
"glog-bench-mt (10 threads, single logger)"
..
echo
"glog-bench-mt (10 threads, single logger)"
..
time
./glog-bench-mt
time
./glog-bench-mt
echo
==================================
echo
echo
sleep
3
sleep
3
echo
"spdlog-bench-mt (10 threads, single logger)"
..
echo
"spdlog-bench-mt (10 threads, single logger)"
..
time
./spdlog-bench-mt
time
./spdlog-bench-mt
echo
==================================
echo
echo
echo
sleep
3
echo
"spdlog-bench-mt-async (10 threads, single logger)"
..
time
./spdlog-bench-mt-async
bench/spdlog-bench-async.cpp
0 → 100644
View file @
0926a6e2
#include "spdlog/spdlog.h"
int
main
(
int
,
char
*
[])
{
int
howmany
=
1000000
;
namespace
spd
=
spdlog
;
spd
::
set_async_mode
(
howmany
,
std
::
chrono
::
seconds
(
0
));
///Create a file rotating logger with 5mb size max and 3 rotated files
auto
logger
=
spd
::
rotating_logger_mt
(
"file_logger"
,
"logs/spd-sample"
,
10
*
1024
*
1024
,
5
);
logger
->
set_pattern
(
"[%Y-%b-%d %T.%e]: %v"
);
for
(
int
i
=
0
;
i
<
howmany
;
++
i
)
logger
->
info
()
<<
"spdlog message #"
<<
i
<<
": This is some text for your pleasure"
;
spd
::
stop
();
return
0
;
}
bench/spdlog-bench-mt-async.cpp
0 → 100644
View file @
0926a6e2
#include <thread>
#include <vector>
#include <atomic>
#include "spdlog/spdlog.h"
#include <iostream>
using
namespace
std
;
int
main
(
int
argc
,
char
*
argv
[])
{
int
thread_count
=
10
;
if
(
argc
>
1
)
thread_count
=
atoi
(
argv
[
1
]);
int
howmany
=
1000000
;
namespace
spd
=
spdlog
;
spd
::
set_async_mode
(
howmany
,
std
::
chrono
::
seconds
(
0
));
///Create a file rotating logger with 5mb size max and 3 rotated files
auto
logger
=
spd
::
rotating_logger_mt
(
"file_logger"
,
"logs/spd-sample"
,
10
*
1024
*
1024
,
5
);
logger
->
set_pattern
(
"[%Y-%b-%d %T.%e]: %v"
);
std
::
atomic
<
int
>
msg_counter
{
0
};
vector
<
thread
>
threads
;
for
(
int
t
=
0
;
t
<
thread_count
;
++
t
)
{
threads
.
push_back
(
std
::
thread
([
&
]()
{
while
(
true
)
{
int
counter
=
++
msg_counter
;
if
(
counter
>
howmany
)
break
;
logger
->
info
()
<<
"spdlog message #"
<<
counter
<<
": This is some text for your pleasure"
;
}
}));
}
for
(
auto
&
t
:
threads
)
{
t
.
join
();
};
spd
::
stop
();
return
0
;
}
bench/spdlog-bench.cpp
View file @
0926a6e2
...
@@ -7,7 +7,7 @@ int main(int, char* [])
...
@@ -7,7 +7,7 @@ int main(int, char* [])
int
howmany
=
1000000
;
int
howmany
=
1000000
;
namespace
spd
=
spdlog
;
namespace
spd
=
spdlog
;
///Create a file rotating logger with 5mb size max and 3 rotated files
///Create a file rotating logger with 5mb size max and 3 rotated files
auto
logger
=
spd
::
rotating_logger_
m
t
(
"file_logger"
,
"logs/spd-sample"
,
10
*
1024
*
1024
,
5
);
auto
logger
=
spd
::
rotating_logger_
s
t
(
"file_logger"
,
"logs/spd-sample"
,
10
*
1024
*
1024
,
5
);
logger
->
set_pattern
(
"[%Y-%b-%d %T.%e]: %v"
);
logger
->
set_pattern
(
"[%Y-%b-%d %T.%e]: %v"
);
for
(
int
i
=
0
;
i
<
howmany
;
++
i
)
for
(
int
i
=
0
;
i
<
howmany
;
++
i
)
...
...
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