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
def6fc62
Commit
def6fc62
authored
Nov 24, 2014
by
gabime
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
updated benchmarks
parent
54b86812
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
108 additions
and
15 deletions
+108
-15
README.md
README.md
+5
-3
bench/results.txt
bench/results.txt
+80
-0
bench/run_all.sh
bench/run_all.sh
+13
-1
bench/spdlog-bench-async.cpp
bench/spdlog-bench-async.cpp
+1
-1
bench/spdlog-bench-mt-async.cpp
bench/spdlog-bench-mt-async.cpp
+1
-1
example/bench.cpp
example/bench.cpp
+8
-9
No files found.
README.md
View file @
def6fc62
...
...
@@ -37,10 +37,12 @@ Just copy the files to your build tree and use a C++11 compiler
Below are some
[
benchmarks
](
bench
)
comparing the time needed to log 1,000,000 lines to file under Ubuntu 64 bit, Intel i7-4770 CPU @ 3.40GHz:
|threads|boost log|glog|g2log|spdlog|
|threads|boost log|glog|g2log|spdlog|
spdlog
<sup>
async mode
</sup>
|
|-------|:-------:|:-----:|------:|------:|
|1|4.223s|1.084s|3.104s|0.998s|
|10|14.141s|4.204s|3.412s|0.987s|
|1|4.430s|1.115s|3.227s|0.940s|1.574s
|10|13.985s|2.027s|3.476s|3.822s|1.972
## Usage Example
...
...
bench/results.txt
0 → 100644
View file @
def6fc62
Running benchmakrs (all with 1000,000 writes to the logs folder
boost-bench (single thread)..
real 0m4.430s
user 0m4.359s
sys 0m0.072s
glog-bench (single thread)..
real 0m1.115s
user 0m0.997s
sys 0m0.117s
g2log-bench (single thread)..
Exiting, log location: logs/g2log-bench.g2log.20141124-232519.log
real 0m3.277s
user 0m4.189s
sys 0m1.021s
spdlog-bench (single thread)
real 0m0.940s
user 0m0.892s
sys 0m0.048s
------------------------------------
Multithreaded benchmarks..
------------------------------------
boost-bench-mt (10 threads, single logger)..
real 0m13.985s
user 0m35.045s
sys 0m7.196s
glog-bench-mt (10 threads, single logger)..
real 0m2.027s
user 0m5.552s
sys 0m6.223s
g2log-bench-mt (10 threads, single logger)..
Exiting, log location: logs/g2log-bench-mt.g2log.20141124-232551.log
real 0m3.476s
user 0m7.649s
sys 0m1.619s
spdlog-bench-mt (10 threads, single logger)..
real 0m3.822s
user 0m14.233s
sys 0m6.117s
------------------------------------
Async benchmarks..
------------------------------------
spdlog-bench-async (single thread)..
real 0m1.574s
user 0m2.613s
sys 0m0.405s
spdlog-bench-mt-async (10 threads, single logger)..
real 0m1.972s
user 0m3.965s
sys 0m2.747s
bench/run_all.sh
View file @
def6fc62
...
...
@@ -24,7 +24,9 @@ time ./spdlog-bench
echo
echo
sleep
3
echo
"------------------------------------"
echo
"Multithreaded benchmarks.."
echo
"------------------------------------"
echo
"boost-bench-mt (10 threads, single logger)"
..
time
./boost-bench-mt
echo
...
...
@@ -49,6 +51,16 @@ echo
echo
sleep
3
echo
"------------------------------------"
echo
"Async benchmarks.."
echo
"------------------------------------"
echo
"spdlog-bench-async (single thread)"
..
time
./spdlog-bench-async
echo
echo
sleep
3
echo
"spdlog-bench-mt-async (10 threads, single logger)"
..
time
./spdlog-bench-mt-async
...
...
bench/spdlog-bench-async.cpp
View file @
def6fc62
...
...
@@ -6,7 +6,7 @@ int main(int, char* [])
{
int
howmany
=
1000000
;
namespace
spd
=
spdlog
;
spd
::
set_async_mode
(
howmany
,
std
::
chrono
::
seconds
(
0
));
spd
::
set_async_mode
(
2500
,
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
);
...
...
bench/spdlog-bench-mt-async.cpp
View file @
def6fc62
...
...
@@ -17,7 +17,7 @@ int main(int argc, char* argv[])
int
howmany
=
1000000
;
namespace
spd
=
spdlog
;
spd
::
set_async_mode
(
howmany
,
std
::
chrono
::
seconds
(
0
));
spd
::
set_async_mode
(
2500
,
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
);
...
...
example/bench.cpp
View file @
def6fc62
...
...
@@ -52,7 +52,7 @@ int main(int argc, char* argv[])
int
howmany
=
1000000
;
int
threads
=
10
;
int
flush_interval
=
100
0
;
int
flush_interval
=
0
;
int
file_size
=
30
*
1024
*
1024
;
int
rotating_files
=
5
;
...
...
@@ -63,7 +63,7 @@ int main(int argc, char* argv[])
howmany
=
atoi
(
argv
[
1
]);
if
(
argc
>
2
)
threads
=
atoi
(
argv
[
2
]);
/*
cout << "*******************************************************************************\n";
cout << "Single thread, " << format(howmany) << " iterations, flush every " << flush_interval << " lines"<< endl;
cout << "*******************************************************************************\n";
...
...
@@ -88,14 +88,13 @@ int main(int argc, char* argv[])
cout << "\n*******************************************************************************\n";
cout << "async logging.. " << threads << " threads sharing same logger, " << format(howmany) << " iterations, flush every " << flush_interval << " lines" << endl;
cout
<<
"*******************************************************************************
\n
"
;
spdlog
::
set_async_mode
(
howmany
);
auto
rotating_st_async
=
spdlog
::
rotating_logger_st
(
"rotating_async"
,
"logs/rotating_async"
,
file_size
,
rotating_files
,
flush_interval
);
bench
(
howmany
,
rotating_st_async
);
e cout << "*******************************************************************************\n";
*/
spdlog
::
set_async_mode
(
2500
);
auto
daily_st_async
=
spdlog
::
daily_logger_st
(
"daily_async"
,
"logs/daily_async"
,
flush_interval
);
bench
(
howmany
,
daily_st_async
);
bench
(
howmany
,
spdlog
::
create
<
null_sink_st
>
(
"null_async"
));
bench
_mt
(
howmany
,
daily_st_async
,
threads
);
spdlog
::
stop
();
...
...
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